Parcourir la source

[myspace] More robust mediatype check

Philipp Hagemeister il y a 11 ans
Parent
commit
5016f3eac8
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      youtube_dl/extractor/myspace.py

+ 2 - 2
youtube_dl/extractor/myspace.py

@@ -10,7 +10,7 @@ from ..utils import (
 
 
 
 
 class MySpaceIE(InfoExtractor):
 class MySpaceIE(InfoExtractor):
-    _VALID_URL = r'https?://myspace\.com/([^/]+)/(?:video/[^/]+/|music/song/.*?)(?P<id>\d+)'
+    _VALID_URL = r'https?://myspace\.com/([^/]+)/(?P<mediatype>video/[^/]+/|music/song/.*?)(?P<id>\d+)'
 
 
     _TESTS = [
     _TESTS = [
         {
         {
@@ -49,7 +49,7 @@ class MySpaceIE(InfoExtractor):
         video_id = mobj.group('id')
         video_id = mobj.group('id')
         webpage = self._download_webpage(url, video_id)
         webpage = self._download_webpage(url, video_id)
 
 
-        if 'music/song' in url:
+        if mobj.group('mediatype').startswith('music/song'):
             # songs don't store any useful info in the 'context' variable
             # songs don't store any useful info in the 'context' variable
             def search_data(name):
             def search_data(name):
                 return self._search_regex(r'data-%s="(.*?)"' % name, webpage,
                 return self._search_regex(r'data-%s="(.*?)"' % name, webpage,