[myspace] Redirect to other extractors
authorTithen-Firion <Tithen-Firion@users.noreply.github.com>
Sun, 30 Nov 2014 19:00:16 +0000 (20:00 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sun, 30 Nov 2014 23:10:12 +0000 (00:10 +0100)
There are many songs just linked from Vevo/YouTube to MySpace.
Vevo example: https://myspace.com/threedaysgrace/music/song/animal-i-have-become-28400208-28218041
YouTube example: https://myspace.com/starset2/music/song/first-light-95799905-106964426

youtube_dl/extractor/myspace.py
youtube_dl/extractor/vevo.py

index 843e1f24a39f074ea6304fb44c7e4d6d23d4bc21..dd0a0415e06917778e12d15768c6eb16f5076a65 100644 (file)
@@ -7,6 +7,7 @@ from .common import InfoExtractor
 from ..compat import (
     compat_str,
 )
+from ..utils import ExtractorError
 
 
 class MySpaceIE(InfoExtractor):
@@ -65,6 +66,18 @@ class MySpaceIE(InfoExtractor):
                     r'''data-%s=([\'"])(.*?)\1''' % name,
                     song_data, name, default='', group=2)
             streamUrl = search_data('stream-url')
+            if not streamUrl:
+                vevo_id = search_data('vevo-id')
+                youtube_id = search_data('youtube-id')
+                if vevo_id:
+                    self.to_screen('Vevo video detected: %s' % vevo_id)
+                    return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
+                elif youtube_id:
+                    self.to_screen('Youtube video detected: %s' % youtube_id)
+                    return self.url_result(youtube_id, ie='Youtube')
+                else:
+                    raise ExtractorError(
+                        'Found song but don\'t know how to download it')
             info = {
                 'id': video_id,
                 'title': self._og_search_title(webpage),
index 5b1a3ec787ac6c99c0db4d37d5ff2c33c6950ef6..c912c3cbe7ae42b221816b50ec6a97139cb13d55 100644 (file)
@@ -13,7 +13,7 @@ from ..utils import (
 class VevoIE(InfoExtractor):
     """
     Accepts urls from vevo.com or in the format 'vevo:{id}'
-    (currently used by MTVIE)
+    (currently used by MTVIE and MySpaceIE)
     """
     _VALID_URL = r'''(?x)
         (?:https?://www\.vevo\.com/watch/(?:[^/]+/(?:[^/]+/)?)?|