[Bilibili:comments] Fix infinite loop (#1423)

Closes #1412
Authored by: u-spec-png
This commit is contained in:
u-spec-png 2021-10-25 19:33:01 +00:00 committed by GitHub
parent ad64a2323f
commit 8e7ab2cf08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -376,8 +376,10 @@ def _get_comments(self, video_id, commentPageNumber=0):
replies = traverse_obj( replies = traverse_obj(
self._download_json( self._download_json(
f'https://api.bilibili.com/x/v2/reply?pn={idx}&oid={video_id}&type=1&jsonp=jsonp&sort=2&_=1567227301685', f'https://api.bilibili.com/x/v2/reply?pn={idx}&oid={video_id}&type=1&jsonp=jsonp&sort=2&_=1567227301685',
video_id, note=f'Extracting comments from page {idx}'), video_id, note=f'Extracting comments from page {idx}', fatal=False),
('data', 'replies')) or [] ('data', 'replies'))
if not replies:
return
for children in map(self._get_all_children, replies): for children in map(self._get_all_children, replies):
yield from children yield from children