[drtv] Extract material id (Closes #4814)
authorSergey M․ <dstftw@gmail.com>
Mon, 2 Feb 2015 15:11:25 +0000 (21:11 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 2 Feb 2015 15:11:25 +0000 (21:11 +0600)
youtube_dl/extractor/drtv.py

index 8d113a5e81d75de50c9364b81da522e8c479ea3d..d5df18d7c971c18f01c51128c75fbe4ee09ea070 100644 (file)
@@ -25,9 +25,15 @@ class DRTVIE(SubtitlesInfoExtractor):
     def _real_extract(self, url):
         video_id = self._match_id(url)
 
-        programcard = self._download_json(
-            'http://www.dr.dk/mu/programcard/expanded/%s' % video_id, video_id, 'Downloading video JSON')
+        webpage = self._download_webpage(url, video_id)
+
+        video_id = self._search_regex(
+            r'data-(?:material-identifier|episode-slug)="([^"]+)"',
+            webpage, 'video id')
 
+        programcard = self._download_json(
+            'http://www.dr.dk/mu/programcard/expanded/%s' % video_id,
+            video_id, 'Downloading video JSON')
         data = programcard['Data'][0]
 
         title = data['Title']