about summary refs log tree commit diff
path: root/youtube_dl/extractor/myspace.py
diff options
context:
space:
mode:
authorTithen-Firion <Tithen-Firion@users.noreply.github.com>2014-11-30 19:36:24 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-12-01 00:10:11 +0100
commit1940fadd5307a11fd64ab26c43fbc31764c213a1 (patch)
tree64bda619cae82b9cc4fa7e5bed9292b4fa10b15e /youtube_dl/extractor/myspace.py
parent03fd72d9967805aff7f28213385cf04e420d136e (diff)
downloadyoutube-dl-1940fadd5307a11fd64ab26c43fbc31764c213a1.tar.gz
youtube-dl-1940fadd5307a11fd64ab26c43fbc31764c213a1.tar.xz
youtube-dl-1940fadd5307a11fd64ab26c43fbc31764c213a1.zip
[myspace] Handle non-playable songs
I'm adding this because sometimes there is a song page, but you cannot play it.
Example: https://myspace.com/starset2/music/song/let-it-die-maniac-agenda-remix-bonus-track-95799916-106964439
It will be useful for downloading whole album with songs like this.
Diffstat (limited to 'youtube_dl/extractor/myspace.py')
-rw-r--r--youtube_dl/extractor/myspace.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/youtube_dl/extractor/myspace.py b/youtube_dl/extractor/myspace.py
index 1a118a37f..843e1f24a 100644
--- a/youtube_dl/extractor/myspace.py
+++ b/youtube_dl/extractor/myspace.py
@@ -53,9 +53,17 @@ class MySpaceIE(InfoExtractor):
 
         if mobj.group('mediatype').startswith('music/song'):
             # songs don't store any useful info in the 'context' variable
+            song_data = self._search_regex(
+                r'''<button.*data-song-id=(["\'])%s\1.*''' % video_id,
+                webpage, 'song_data', default=None, group=0)
+            if song_data is None:
+                self.to_screen(
+                    '%s: No downloadable song on this page' % video_id)
+                return
             def search_data(name):
                 return self._search_regex(
-                    r'data-%s="(.*?)"' % name, webpage, name)
+                    r'''data-%s=([\'"])(.*?)\1''' % name,
+                    song_data, name, default='', group=2)
             streamUrl = search_data('stream-url')
             info = {
                 'id': video_id,