]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[limelight] Improve and make more robust (closes #11737)
authorSergey M․ <dstftw@gmail.com>
Mon, 16 Jan 2017 14:54:47 +0000 (21:54 +0700)
committerSergey M․ <dstftw@gmail.com>
Mon, 16 Jan 2017 14:54:47 +0000 (21:54 +0700)
+ Add support for direct http for videos hosted on video.llnw.net
* Check handmade http URLs

youtube_dl/extractor/limelight.py

index 905a0e85f78ad9fb36ea58daca2cc2f4ea55e7c3..e635f3c4dc46c6407a166dec9ab2ef06981b6221 100644 (file)
@@ -59,14 +59,26 @@ class LimelightBaseIE(InfoExtractor):
                     format_id = 'rtmp'
                     if stream.get('videoBitRate'):
                         format_id += '-%d' % int_or_none(stream['videoBitRate'])
-                    http_url = 'http://cpl.delvenetworks.com/' + rtmp.group('playpath')[4:]
-                    urls.append(http_url)
-                    http_fmt = fmt.copy()
-                    http_fmt.update({
-                        'url': http_url,
-                        'format_id': format_id.replace('rtmp', 'http'),
-                    })
-                    formats.append(http_fmt)
+                    http_format_id = format_id.replace('rtmp', 'http')
+
+                    CDN_HOSTS = (
+                        ('delvenetworks.com', 'cpl.delvenetworks.com'),
+                        ('video.llnw.net', 's2.content.video.llnw.net'),
+                    )
+                    for cdn_host, http_host in CDN_HOSTS:
+                        if cdn_host not in rtmp.group('host').lower():
+                            continue
+                        http_url = 'http://%s/%s' % (http_host, rtmp.group('playpath')[4:])
+                        urls.append(http_url)
+                        if self._is_valid_url(http_url, video_id, http_format_id):
+                            http_fmt = fmt.copy()
+                            http_fmt.update({
+                                'url': http_url,
+                                'format_id': http_format_id,
+                            })
+                            formats.append(http_fmt)
+                            break
+
                     fmt.update({
                         'url': rtmp.group('url'),
                         'play_path': rtmp.group('playpath'),