Browse Source

[eagleplatform] Checking direct HTTP links

Sometimes they fail with 404
Yen Chi Hsuan 9 years ago
parent
commit
4645432d7a
2 changed files with 7 additions and 2 deletions
  1. 5 2
      youtube_dl/extractor/eagleplatform.py
  2. 2 0
      youtube_dl/extractor/generic.py

+ 5 - 2
youtube_dl/extractor/eagleplatform.py

@@ -23,7 +23,7 @@ class EaglePlatformIE(InfoExtractor):
     _TESTS = [{
     _TESTS = [{
         # http://lenta.ru/news/2015/03/06/navalny/
         # http://lenta.ru/news/2015/03/06/navalny/
         'url': 'http://lentaru.media.eagleplatform.com/index/player?player=new&record_id=227304&player_template_id=5201',
         'url': 'http://lentaru.media.eagleplatform.com/index/player?player=new&record_id=227304&player_template_id=5201',
-        'md5': '881ee8460e1b7735a8be938e2ffb362b',
+        # Not checking MD5 as sometimes the direct HTTP link results in 404 and HLS is used
         'info_dict': {
         'info_dict': {
             'id': '227304',
             'id': '227304',
             'ext': 'mp4',
             'ext': 'mp4',
@@ -109,8 +109,11 @@ class EaglePlatformIE(InfoExtractor):
             mobj = re.search('/([^/]+)/index\.m3u8', m3u8_format['url'])
             mobj = re.search('/([^/]+)/index\.m3u8', m3u8_format['url'])
             if mobj:
             if mobj:
                 http_format = m3u8_format.copy()
                 http_format = m3u8_format.copy()
+                video_url = mp4_url.replace(mp4_url_basename, mobj.group(1))
+                if not self._is_valid_url(video_url, video_id):
+                    continue
                 http_format.update({
                 http_format.update({
-                    'url': mp4_url.replace(mp4_url_basename, mobj.group(1)),
+                    'url': video_url,
                     'format_id': m3u8_format['format_id'].replace('hls', 'http'),
                     'format_id': m3u8_format['format_id'].replace('hls', 'http'),
                     'protocol': 'http',
                     'protocol': 'http',
                 })
                 })

+ 2 - 0
youtube_dl/extractor/generic.py

@@ -887,6 +887,7 @@ class GenericIE(InfoExtractor):
         # Eagle.Platform embed (generic URL)
         # Eagle.Platform embed (generic URL)
         {
         {
             'url': 'http://lenta.ru/news/2015/03/06/navalny/',
             'url': 'http://lenta.ru/news/2015/03/06/navalny/',
+            # Not checking MD5 as sometimes the direct HTTP link results in 404 and HLS is used
             'info_dict': {
             'info_dict': {
                 'id': '227304',
                 'id': '227304',
                 'ext': 'mp4',
                 'ext': 'mp4',
@@ -901,6 +902,7 @@ class GenericIE(InfoExtractor):
         # ClipYou (Eagle.Platform) embed (custom URL)
         # ClipYou (Eagle.Platform) embed (custom URL)
         {
         {
             'url': 'http://muz-tv.ru/play/7129/',
             'url': 'http://muz-tv.ru/play/7129/',
+            # Not checking MD5 as sometimes the direct HTTP link results in 404 and HLS is used
             'info_dict': {
             'info_dict': {
                 'id': '12820',
                 'id': '12820',
                 'ext': 'mp4',
                 'ext': 'mp4',