diff options
author | Aakash Gajjar <skyqutip@gmail.com> | 2020-02-15 12:30:12 +0530 |
---|---|---|
committer | Aakash Gajjar <skyqutip@gmail.com> | 2020-02-15 12:30:12 +0530 |
commit | 6255e567d92e7d8fe7920c34db050a95b8d3ff7f (patch) | |
tree | cdaf426e70bb927820e08a011c689fbaec61bfb0 | |
parent | 6fb11ca8515eb8f9dcdc1f982b3f2993932540dc (diff) | |
download | hypervideo-pre-6255e567d92e7d8fe7920c34db050a95b8d3ff7f.tar.lz hypervideo-pre-6255e567d92e7d8fe7920c34db050a95b8d3ff7f.tar.xz hypervideo-pre-6255e567d92e7d8fe7920c34db050a95b8d3ff7f.zip |
[tiktok] fix regex
-rw-r--r-- | youtube_dl/extractor/tiktok.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/youtube_dl/extractor/tiktok.py b/youtube_dl/extractor/tiktok.py index d4f6d9055..613ac9cc8 100644 --- a/youtube_dl/extractor/tiktok.py +++ b/youtube_dl/extractor/tiktok.py @@ -65,16 +65,7 @@ class TikTokBaseIE(InfoExtractor): class TikTokIE(TikTokBaseIE): - _VALID_URL = r'''(?x) - https?:// - (?: - (?:www|vm)\. - (?:tiktok.com)\/ - (@(?P<username>[\w\.]+))\/ - (?:video)\/ - ) - (?P<id>[\d]{6,}) - ''' + _VALID_URL = r'https?://www\.tiktok\.com/@[\w\._]+/video/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.tiktok.com/@leenabhushan/video/6748451240264420610', @@ -133,8 +124,8 @@ class TikTokIE(TikTokBaseIE): webpage = self._download_webpage(url, video_id, note='Downloading video webpage') json_string = self._search_regex( - r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P<json_string>[^<]+)', - webpage, 'json_string', group='json_string') + r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P<json_string_ld>[^<]+)', + webpage, 'json_string', group='json_string_ld') json_data = self._parse_json(json_string, video_id) video_data = try_get(json_data, lambda x: x['props']['pageProps'], expected_type=dict) |