Skip to content

Commit

Permalink
[mtv] Add alternate way to retrieve mgid
Browse files Browse the repository at this point in the history
Use the embed URL to retrieve the mgid for a given episode, if all other
methods fail.

Fixes ytdl-org/youtube-dl#5369.
  • Loading branch information
malept committed Apr 7, 2015
1 parent 29713e4 commit a4d5b00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions youtube_dl/extractor/mtv.py
Expand Up @@ -182,7 +182,8 @@ def _real_extract(self, url):

if mgid is None or ':' not in mgid:
mgid = self._search_regex(
[r'data-mgid="(.*?)"', r'swfobject.embedSWF\(".*?(mgid:.*?)"'],
[r'data-mgid="(.*?)"', r'swfobject.embedSWF\(".*?(mgid:.*?)"',
r'sm4:video:embed.*?' + MTVServicesEmbeddedIE._VALID_URL],
webpage, 'mgid')

videos_info = self._get_videos_info(mgid)
Expand All @@ -191,7 +192,7 @@ def _real_extract(self, url):

class MTVServicesEmbeddedIE(MTVServicesInfoExtractor):
IE_NAME = 'mtvservices:embedded'
_VALID_URL = r'https?://media\.mtvnservices\.com/embed/(?P<mgid>.+?)(\?|/|$)'
_VALID_URL = r'https?://media\.mtvnservices\.com/embed/(?P<mgid>.+?)(\?|/|&|$)'

_TEST = {
# From http://www.thewrap.com/peter-dinklage-sums-up-game-of-thrones-in-45-seconds-video/
Expand Down

0 comments on commit a4d5b00

Please sign in to comment.