]> jfr.im git - yt-dlp.git/commitdiff
[ie/tiktok] Fix webpage extraction
authorbashonly <redacted>
Sat, 16 Sep 2023 18:28:14 +0000 (13:28 -0500)
committerbashonly <redacted>
Sat, 16 Sep 2023 18:28:14 +0000 (13:28 -0500)
Closes #8089
Authored by: bashonly

yt_dlp/extractor/tiktok.py

index f14c4f9d6aaefc0d50a2e49f03c5c3407fe7f053..f26972cff2d96294d4c9d44d4f1308d3e1ec944b 100644 (file)
@@ -15,7 +15,6 @@
     UserNotLive,
     determine_ext,
     format_field,
-    get_element_by_id,
     get_first,
     int_or_none,
     join_nonempty,
@@ -50,8 +49,9 @@ def _create_url(user_id, video_id):
         return f'https://www.tiktok.com/@{user_id or "_"}/video/{video_id}'
 
     def _get_sigi_state(self, webpage, display_id):
-        return self._parse_json(get_element_by_id(
-            'SIGI_STATE|sigi-persisted-data', webpage, escape_value=False), display_id)
+        return self._search_json(
+            r'<script[^>]+\bid="(?:SIGI_STATE|sigi-persisted-data)"[^>]*>', webpage,
+            'sigi state', display_id, end_pattern=r'</script>')
 
     def _call_api_impl(self, ep, query, manifest_app_version, video_id, fatal=True,
                        note='Downloading API JSON', errnote='Unable to download API page'):