mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-01-31 09:41:18 +02:00
[ie/BiliBiliDynamic] Add extractor (#11838)
Some checks failed
CodeQL / Analyze (python) (push) Failing after 1m31s
Download Tests / Quick Download Tests (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Has been skipped
Quick Test / Code check (push) Successful in 1m36s
Quick Test / Core Test (push) Successful in 4m19s
Release (master) / release (push) Has been skipped
Release (master) / publish_pypi (push) Has been skipped
Release (nightly) / release (push) Has been skipped
Release (nightly) / publish_pypi (push) Has been skipped
Release (nightly) / check_nightly (push) Has been skipped
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, pypy-3.10) (push) Has been cancelled
Some checks failed
CodeQL / Analyze (python) (push) Failing after 1m31s
Download Tests / Quick Download Tests (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Has been skipped
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Has been skipped
Quick Test / Code check (push) Successful in 1m36s
Quick Test / Core Test (push) Successful in 4m19s
Release (master) / release (push) Has been skipped
Release (master) / publish_pypi (push) Has been skipped
Release (nightly) / release (push) Has been skipped
Release (nightly) / publish_pypi (push) Has been skipped
Release (nightly) / check_nightly (push) Has been skipped
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, pypy-3.10) (push) Has been cancelled
Closes #11726 Authored by: finch71, grqz Co-authored-by: N/Ame <173015200+grqz@users.noreply.github.com>
This commit is contained in:
parent
f9f24ae376
commit
9676b05715
@ -256,6 +256,7 @@ from .bilibili import (
|
|||||||
BilibiliCheeseIE,
|
BilibiliCheeseIE,
|
||||||
BilibiliCheeseSeasonIE,
|
BilibiliCheeseSeasonIE,
|
||||||
BilibiliCollectionListIE,
|
BilibiliCollectionListIE,
|
||||||
|
BiliBiliDynamicIE,
|
||||||
BilibiliFavoritesListIE,
|
BilibiliFavoritesListIE,
|
||||||
BiliBiliIE,
|
BiliBiliIE,
|
||||||
BiliBiliPlayerIE,
|
BiliBiliPlayerIE,
|
||||||
|
@ -32,6 +32,7 @@ from ..utils import (
|
|||||||
parse_qs,
|
parse_qs,
|
||||||
parse_resolution,
|
parse_resolution,
|
||||||
qualities,
|
qualities,
|
||||||
|
sanitize_url,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
srt_subtitles_timecode,
|
srt_subtitles_timecode,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
@ -1861,6 +1862,47 @@ class BiliBiliPlayerIE(InfoExtractor):
|
|||||||
ie=BiliBiliIE.ie_key(), video_id=video_id)
|
ie=BiliBiliIE.ie_key(), video_id=video_id)
|
||||||
|
|
||||||
|
|
||||||
|
class BiliBiliDynamicIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:t\.bilibili\.com|(?:www\.)?bilibili\.com/opus)/(?P<id>\d+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://t.bilibili.com/998134289197432852',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'BV1TAmBYVEJr',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'uploader_id': '1192648858',
|
||||||
|
'comment_count': int,
|
||||||
|
'_old_archive_ids': ['bilibili 113457567568273_part1'],
|
||||||
|
'thumbnail': 'http://i2.hdslb.com/bfs/archive/50091efd965d9f13ff6814f7ad374f90ab21e77d.jpg',
|
||||||
|
'duration': 929.238,
|
||||||
|
'upload_date': '20241110',
|
||||||
|
'uploader': '何同学工作室',
|
||||||
|
'like_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'title': '美国小朋友就玩这个?!何同学工作室11月开箱',
|
||||||
|
'description': '本期产品信息:\n机器狗\n气味模拟器\nCloudboom Strike LS\n无弦吉他\n蓝牙磁带音箱\n神奇画板',
|
||||||
|
'timestamp': 1731232800,
|
||||||
|
'tags': list,
|
||||||
|
'chapters': list,
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
post_id = self._match_id(url)
|
||||||
|
# Without the newer chrome UA, the API will return an error (-352)
|
||||||
|
post_data = self._download_json(
|
||||||
|
'https://api.bilibili.com/x/polymer/web-dynamic/v1/detail', post_id,
|
||||||
|
query={'id': post_id}, headers={
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
||||||
|
})
|
||||||
|
video_url = traverse_obj(post_data, (
|
||||||
|
'data', 'item', (None, 'orig'), 'modules', 'module_dynamic',
|
||||||
|
(('major', ('archive', 'pgc')), ('additional', ('reserve', 'common'))),
|
||||||
|
'jump_url', {url_or_none}, any, {sanitize_url}))
|
||||||
|
if not video_url or (self.suitable(video_url) and post_id == self._match_id(video_url)):
|
||||||
|
raise ExtractorError('No valid video URL found', expected=True)
|
||||||
|
return self.url_result(video_url)
|
||||||
|
|
||||||
|
|
||||||
class BiliIntlBaseIE(InfoExtractor):
|
class BiliIntlBaseIE(InfoExtractor):
|
||||||
_API_URL = 'https://api.bilibili.tv/intl/gateway'
|
_API_URL = 'https://api.bilibili.tv/intl/gateway'
|
||||||
_NETRC_MACHINE = 'biliintl'
|
_NETRC_MACHINE = 'biliintl'
|
||||||
|
Loading…
Reference in New Issue
Block a user