1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-23 17:04:33 +01:00

[tiktok] fix json_string extraction

This commit is contained in:
Aakash Gajjar 2019-12-24 11:39:43 +05:30
parent bd62ec31cc
commit b901b6a08b

View File

@ -239,7 +239,7 @@ class TikTokIE(TikTokBaseIE):
} }
webpage = self._download_webpage(url, video_id, headers=headers, note='Downloading video webpage') webpage = self._download_webpage(url, video_id, headers=headers, note='Downloading video webpage')
json_string = self._search_regex( json_string = self._search_regex(
r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\">\s*(?P<json_string>[^<]+)', r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P<json_string>[^<]+)',
webpage, 'json_string', group='json_string') webpage, 'json_string', group='json_string')
json_data = self._parse_json(json_string, video_id) json_data = self._parse_json(json_string, video_id)
video_data = try_get(json_data, lambda x: x['props']['pageProps'], expected_type=dict) video_data = try_get(json_data, lambda x: x['props']['pageProps'], expected_type=dict)