fix page count error in 'space_video' case

This commit is contained in:
SHMoney2021 2021-03-08 08:52:43 +08:00
parent c9234a20c9
commit 28af439fca

View File

@ -4,6 +4,8 @@ from ..common import *
from ..extractor import VideoExtractor from ..extractor import VideoExtractor
import hashlib import hashlib
import math
class Bilibili(VideoExtractor): class Bilibili(VideoExtractor):
name = "Bilibili" name = "Bilibili"
@ -734,7 +736,8 @@ class Bilibili(VideoExtractor):
api_url = self.bilibili_space_video_api(mid) api_url = self.bilibili_space_video_api(mid)
api_content = get_content(api_url, headers=self.bilibili_headers()) api_content = get_content(api_url, headers=self.bilibili_headers())
videos_info = json.loads(api_content) videos_info = json.loads(api_content)
pc = videos_info['data']['page']['count'] // videos_info['data']['page']['ps'] # pc = videos_info['data']['page']['count'] // videos_info['data']['page']['ps']
pc = math.ceil(videos_info['data']['page']['count'] / videos_info['data']['page']['ps'])
for pn in range(1, pc + 1): for pn in range(1, pc + 1):
api_url = self.bilibili_space_video_api(mid, pn=pn) api_url = self.bilibili_space_video_api(mid, pn=pn)