Skip to content

Commit 042a055

Browse files
committed
nico: hotfix
1 parent 35c80bb commit 042a055

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

nico.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,15 @@ def download_comments(self, room_info, when, filename):
150150
chats_all = _
151151
chats_all.sort(key=lambda x: (x['chat']['date'], x['chat'].get('vpos', 0)))
152152

153-
print(f'Total unique comments: {len(chats_all)}. Save to {filename}.json.')
154153
dump_json(chats_all, self.save_dir / f'{filename}.json')
154+
print(f'Total unique comments: {len(chats_all)}. Saved to "{filename}.json".')
155155

156156
def download_timeshift(self, url_or_video_id, info_only=False, comments='yes', verbose=False, dump=False, auto_reserve=False):
157157
video_id, url, video_type = self._parse_url_or_video_id(url_or_video_id)
158158

159159
return_value = {
160160
'id': video_id,
161161
'url': url,
162-
'title': title,
163162
'type': video_type,
164163
}
165164

@@ -189,6 +188,7 @@ def download_timeshift(self, url_or_video_id, info_only=False, comments='yes', v
189188
print(t)
190189

191190
return_value.update({
191+
'title': title,
192192
'begin_time': begin_time_dt,
193193
'end_time': end_time_dt,
194194
'short_date': date,
@@ -363,6 +363,7 @@ def _split_lines(self, text, width):
363363
parser.add_argument('--comments', '-d', default='yes', choices=['yes', 'no', 'only'], help='Control if comments (danmaku) are downloaded. [Default: yes]')
364364
parser.add_argument('--proxy', default='auto', help='Specify a proxy, "none", or "auto" (automatically detects system proxy settings). [Default: auto]')
365365
parser.add_argument('--save-dir', '-o', help='Specify the directory to save the downloaded files. [Default: current directory]')
366+
parser.add_argument('--reserve', action='store_true', help='Automatically reserve timeshift ticket if not reserved yet. [Default: no]')
366367

367368
args = parser.parse_args()
368369

@@ -371,6 +372,6 @@ def _split_lines(self, text, width):
371372
if args.thumb:
372373
nico_downloader.download_thumbnail(args.url, info_only=args.info, dump=args.dump)
373374
else:
374-
nico_downloader.download_timeshift(args.url, info_only=args.info, verbose=args.verbose, comments=args.comments, dump=args.dump)
375+
nico_downloader.download_timeshift(args.url, info_only=args.info, verbose=args.verbose, comments=args.comments, dump=args.dump, auto_reserve=args.reserve)
375376

376377

0 commit comments

Comments
 (0)