1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-25 09:19:48 +00:00

[comcarcoff] Improve json data regex and modernize

This commit is contained in:
Sergey M․ 2015-12-23 01:10:31 +06:00
parent 11208ebbf1
commit 4c24ed9464

View file

@ -31,9 +31,10 @@ class ComCarCoffIE(InfoExtractor):
display_id = 'comediansincarsgettingcoffee.com' display_id = 'comediansincarsgettingcoffee.com'
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
full_data = json.loads(self._search_regex( full_data = self._parse_json(
r'\nwindow.app = (?P<json>.+?);\n', self._search_regex(
webpage, 'full data json'))['videoData'] r'window\.app\s*=\s*({.+?});\n', webpage, 'full data json'),
display_id)['videoData']
video_id = full_data['activeVideo']['video'] video_id = full_data['activeVideo']['video']
video_data = full_data.get('videos', {}).get(video_id) or full_data['singleshots'][video_id] video_data = full_data.get('videos', {}).get(video_id) or full_data['singleshots'][video_id]