mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-09-18 03:42:31 +09:00
[ie/tiktok] Support browser impersonation (#14473)
CodeQL / Analyze (python) (push) Has been cancelled
Download Tests / Quick Download Tests (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.14-dev) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.11) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, pypy-3.11) (push) Has been cancelled
Quick Test / Core Test (push) Has been cancelled
Quick Test / Code check (push) Has been cancelled
Release (master) / release (push) Has been cancelled
Release (master) / publish_pypi (push) Has been cancelled
Keep cache warm / build (push) Has been cancelled
Release (nightly) / check_nightly (push) Has been cancelled
Release (nightly) / release (push) Has been cancelled
Release (nightly) / publish_pypi (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Download Tests / Quick Download Tests (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.14-dev) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.11) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, pypy-3.11) (push) Has been cancelled
Quick Test / Core Test (push) Has been cancelled
Quick Test / Code check (push) Has been cancelled
Release (master) / release (push) Has been cancelled
Release (master) / publish_pypi (push) Has been cancelled
Keep cache warm / build (push) Has been cancelled
Release (nightly) / check_nightly (push) Has been cancelled
Release (nightly) / release (push) Has been cancelled
Release (nightly) / publish_pypi (push) Has been cancelled
Closes #10919, Closes #12574 Authored by: thanhtaivtt, bashonly Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
@@ -220,7 +220,7 @@ class TikTokBaseIE(InfoExtractor):
|
||||
def _extract_web_data_and_status(self, url, video_id, fatal=True):
|
||||
video_data, status = {}, -1
|
||||
|
||||
res = self._download_webpage_handle(url, video_id, fatal=fatal, headers={'User-Agent': 'Mozilla/5.0'})
|
||||
res = self._download_webpage_handle(url, video_id, fatal=fatal, impersonate=True)
|
||||
if res is False:
|
||||
return video_data, status
|
||||
|
||||
@@ -1071,7 +1071,7 @@ class TikTokUserIE(TikTokBaseIE):
|
||||
webpage = self._download_webpage(
|
||||
self._UPLOADER_URL_FORMAT % user_name, user_name,
|
||||
'Downloading user webpage', 'Unable to download user webpage',
|
||||
fatal=False, headers={'User-Agent': 'Mozilla/5.0'}) or ''
|
||||
fatal=False, impersonate=True) or ''
|
||||
detail = traverse_obj(
|
||||
self._get_universal_data(webpage, user_name), ('webapp.user-detail', {dict})) or {}
|
||||
if detail.get('statusCode') == 10222:
|
||||
@@ -1520,7 +1520,7 @@ class TikTokLiveIE(TikTokBaseIE):
|
||||
uploader, room_id = self._match_valid_url(url).group('uploader', 'id')
|
||||
if not room_id:
|
||||
webpage = self._download_webpage(
|
||||
format_field(uploader, None, self._UPLOADER_URL_FORMAT), uploader)
|
||||
format_field(uploader, None, self._UPLOADER_URL_FORMAT), uploader, impersonate=True)
|
||||
room_id = traverse_obj(
|
||||
self._get_universal_data(webpage, uploader),
|
||||
('webapp.user-detail', 'userInfo', 'user', 'roomId', {str}))
|
||||
|
||||
Reference in New Issue
Block a user