[ie/tiktok] Fix extractor (#17452)

Closes #17403, Closes #17437
Authored by: bashonly
This commit is contained in:
bashonly
2026-08-18 10:17:12 +00:00
committed by GitHub
parent f1896c57f5
commit b375e1d85c
3 changed files with 18 additions and 17 deletions
+13
View File
@@ -3960,6 +3960,19 @@ class InfoExtractor:
headers['Ytdl-request-proxy'] = geo_verification_proxy
return headers
@staticmethod
def _generate_blockbuster_headers(*, min_headers=2, max_headers=8):
"""Randomize our HTTP header fingerprint in an attempt to bust HTTP Error 403 blockage"""
def random_letters(minimum, maximum):
# Omit vowels so we don't generate valid header names like 'authorization', etc
return ''.join(random.choices('bcdfghjklmnpqrstvwxz', k=random.randint(minimum, maximum)))
return {
random_letters(8, 24): random_letters(16, 32)
for _ in range(random.randint(min_headers, max_headers))
}
@staticmethod
def _generic_id(url):
return urllib.parse.unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])