mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-20 13:57:25 +01:00
apply patch from comment https://github.com/yt-dlp/yt-dlp/pull/10317#issuecomment-2202289727
This commit is contained in:
parent
4c16680c00
commit
853a9224f5
@ -1742,7 +1742,7 @@ def _search_results(self, query):
|
|||||||
yield self.url_result(bili_user_prefix + str(result_data['mid']))
|
yield self.url_result(bili_user_prefix + str(result_data['mid']))
|
||||||
|
|
||||||
|
|
||||||
class BiliBiliSearchIE(SearchInfoExtractor):
|
class BiliBiliSearchIE(SearchInfoExtractor, BilibiliBaseIE):
|
||||||
IE_DESC = 'Bilibili video search'
|
IE_DESC = 'Bilibili video search'
|
||||||
_MAX_RESULTS = 100000
|
_MAX_RESULTS = 100000
|
||||||
_SEARCH_KEY = 'bilisearch'
|
_SEARCH_KEY = 'bilisearch'
|
||||||
@ -1777,21 +1777,16 @@ class BiliBiliSearchIE(SearchInfoExtractor):
|
|||||||
def _search_results(self, query):
|
def _search_results(self, query):
|
||||||
if not self._get_cookies('https://api.bilibili.com').get('buvid3'):
|
if not self._get_cookies('https://api.bilibili.com').get('buvid3'):
|
||||||
self._set_cookie('.bilibili.com', 'buvid3', f'{uuid.uuid4()}infoc')
|
self._set_cookie('.bilibili.com', 'buvid3', f'{uuid.uuid4()}infoc')
|
||||||
|
headers = self.geo_verification_headers()
|
||||||
|
headers['Referer'] = 'https://www.bilibili.com/'
|
||||||
for page_num in itertools.count(1):
|
for page_num in itertools.count(1):
|
||||||
videos = self._download_json(
|
videos = self._download_json(
|
||||||
'https://api.bilibili.com/x/web-interface/search/type', query,
|
'https://api.bilibili.com/x/web-interface/wbi/search/type', query,
|
||||||
note=f'Extracting results from page {page_num}', query={
|
note=f'Extracting results from page {page_num}', query=self._sign_wbi({
|
||||||
'Search_key': query,
|
|
||||||
'keyword': query,
|
'keyword': query,
|
||||||
'page': page_num,
|
'page': page_num,
|
||||||
'context': '',
|
|
||||||
'duration': 0,
|
|
||||||
'tids_2': '',
|
|
||||||
'__refresh__': 'true',
|
|
||||||
'search_type': 'video',
|
'search_type': 'video',
|
||||||
'tids': 0,
|
}, query), headers=headers)['data'].get('result')
|
||||||
'highlight': 1,
|
|
||||||
})['data'].get('result')
|
|
||||||
if not videos:
|
if not videos:
|
||||||
break
|
break
|
||||||
for video in videos:
|
for video in videos:
|
||||||
|
Loading…
Reference in New Issue
Block a user