mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 00:22:34 +01:00
[extractor/tiktok] Update _VALID_URL
, add api_hostname
arg (#5708)
Closes #5706 Authored by: bashonly
This commit is contained in:
parent
c53a18f016
commit
c4cbd3bebd
@ -1765,6 +1765,7 @@ #### hotstar
|
||||
* `dr`: dynamic range to ignore - one or more of `sdr`, `hdr10`, `dv`
|
||||
|
||||
#### tiktok
|
||||
* `api_hostname`: Hostname to use for mobile API requests, e.g. `api-h2.tiktokv.com`
|
||||
* `app_version`: App version to call mobile APIs with - should be set along with `manifest_app_version`, e.g. `20.2.1`
|
||||
* `manifest_app_version`: Numeric app version to call mobile APIs with, e.g. `221`
|
||||
|
||||
|
@ -30,11 +30,15 @@ class TikTokBaseIE(InfoExtractor):
|
||||
_WORKING_APP_VERSION = None
|
||||
_APP_NAME = 'trill'
|
||||
_AID = 1180
|
||||
_API_HOSTNAME = 'api16-normal-c-useast1a.tiktokv.com'
|
||||
_UPLOADER_URL_FORMAT = 'https://www.tiktok.com/@%s'
|
||||
_WEBPAGE_HOST = 'https://www.tiktok.com/'
|
||||
QUALITIES = ('360p', '540p', '720p', '1080p')
|
||||
|
||||
@property
|
||||
def _API_HOSTNAME(self):
|
||||
return self._configuration_arg(
|
||||
'api_hostname', ['api16-normal-c-useast1a.tiktokv.com'], ie_key=TikTokIE)[0]
|
||||
|
||||
@staticmethod
|
||||
def _create_url(user_id, video_id):
|
||||
return f'https://www.tiktok.com/@{user_id or "_"}/video/{video_id}'
|
||||
@ -398,7 +402,7 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url):
|
||||
|
||||
|
||||
class TikTokIE(TikTokBaseIE):
|
||||
_VALID_URL = r'https?://www\.tiktok\.com/(?:embed|@(?P<user_id>[\w\.-]+)/video)/(?P<id>\d+)'
|
||||
_VALID_URL = r'https?://www\.tiktok\.com/(?:embed|@(?P<user_id>[\w\.-]+)?/video)/(?P<id>\d+)'
|
||||
_EMBED_REGEX = [rf'<(?:script|iframe)[^>]+\bsrc=(["\'])(?P<url>{_VALID_URL})']
|
||||
|
||||
_TESTS = [{
|
||||
@ -944,8 +948,27 @@ class TikTokVMIE(InfoExtractor):
|
||||
'creator': 'SigmaChad',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://vm.tiktok.com/ZSe4FqkKd',
|
||||
'only_matching': True,
|
||||
'url': 'https://vm.tiktok.com/ZTR45GpSF/',
|
||||
'info_dict': {
|
||||
'id': '7106798200794926362',
|
||||
'ext': 'mp4',
|
||||
'title': 'md5:edc3e7ea587847f8537468f2fe51d074',
|
||||
'uploader_id': '6997695878846268418',
|
||||
'upload_date': '20220608',
|
||||
'view_count': int,
|
||||
'like_count': int,
|
||||
'comment_count': int,
|
||||
'thumbnail': r're:https://.+\.webp.*',
|
||||
'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAAdZ_NcPPgMneaGrW0hN8O_J_bwLshwNNERRF5DxOw2HKIzk0kdlLrR8RkVl1ksrMO',
|
||||
'duration': 29,
|
||||
'timestamp': 1654680400,
|
||||
'repost_count': int,
|
||||
'artist': 'Akihitoko',
|
||||
'track': 'original sound',
|
||||
'description': 'md5:edc3e7ea587847f8537468f2fe51d074',
|
||||
'uploader': 'akihitoko1',
|
||||
'creator': 'Akihitoko',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://vt.tiktok.com/ZSe4FqkKd',
|
||||
'only_matching': True,
|
||||
|
Loading…
Reference in New Issue
Block a user