aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-06-07 15:53:30 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-06-07 15:53:30 +0200
commit6ab8f3584a1cfea1c4b952551cb9b72c05bed29b (patch)
tree016766b484c118a476622327272b2fd8af9b3353 /youtube_dl/extractor
parent8ae5ce17264fde131acd11a454cafe9a32a34bac (diff)
parent34d863f3fc104f58c9fd35298d33714c2c57a9f1 (diff)
Merge remote-tracking branch 'ralfharing/vh1'
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/__init__.py6
-rw-r--r--youtube_dl/extractor/mtv.py1
-rw-r--r--youtube_dl/extractor/vh1.py121
3 files changed, 128 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index ace298fb3..01c21189b 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -306,6 +306,12 @@ from .veehd import VeeHDIE
from .veoh import VeohIE
from .vesti import VestiIE
from .vevo import VevoIE
+from .vh1 import (
+ VH1EpisodeIE,
+ VH1ClipIE,
+ VH1ShortUrlIE,
+ VH1MusicVideoIE
+)
from .viddler import ViddlerIE
from .videobam import VideoBamIE
from .videodetective import VideoDetectiveIE
diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py
index d75241d3f..e5ca41b40 100644
--- a/youtube_dl/extractor/mtv.py
+++ b/youtube_dl/extractor/mtv.py
@@ -80,6 +80,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
})
except (KeyError, TypeError):
raise ExtractorError('Invalid rendition field.')
+ self._sort_formats(formats)
return formats
def _get_video_info(self, itemdoc):
diff --git a/youtube_dl/extractor/vh1.py b/youtube_dl/extractor/vh1.py
new file mode 100644
index 000000000..0e30d7bde
--- /dev/null
+++ b/youtube_dl/extractor/vh1.py
@@ -0,0 +1,121 @@
+from .mtv import MTVIE
+import re
+from ..utils import fix_xml_ampersands
+
+class VH1IE(MTVIE):
+ IE_NAME = u'vh1.com'
+ _FEED_URL = 'http://www.vh1.com/player/embed/AS3/fullepisode/rss/'
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('videoid')
+ idoc = self._download_xml(
+ self._FEED_URL + '?id=' + video_id, video_id,
+ 'Downloading info', transform_source=fix_xml_ampersands)
+ return [self._get_video_info(item) for item in idoc.findall('.//item')]
+
+
+class VH1EpisodeIE(VH1IE):
+ _VALID_URL = r'https?://www\.vh1\.com/video/.+?/full-episodes/.+?/(?P<videoid>[^/]+)/playlist\.jhtml'
+ _TESTS = [
+ {
+ u'url': u'http://www.vh1.com/video/metal-evolution/full-episodes/progressive-metal/1678612/playlist.jhtml',
+ u'playlist': [
+ {
+ u'info_dict': {
+ u'id': u'731565',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Ep. 11 Act 1',
+ u'description': u'Many rock academics have proclaimed that the truly progressive musicianship of the last 20 years has been found right here in the world of heavy metal, rather than obvious locales such as jazz, fusion or progressive rock. It stands to reason then, that much of this jaw-dropping virtuosity occurs within what\'s known as progressive metal, a genre that takes root with the likes of Rush in the \'70s, Queensryche and Fates Warning in the \'80s, and Dream Theater in the \'90s. Since then, the genre has exploded with creativity, spawning mind-bending, genre-defying acts such as Tool, Mastodon, Coheed And Cambria, Porcupine Tree, Meshuggah, A Perfect Circle and Opeth. Episode 12 looks at the extreme musicianship of these bands, as well as their often extreme literary prowess and conceptual strength, the end result being a rich level of respect and attention such challenging acts have brought upon the world of heavy metal, from a critical community usually dismissive of the form.'
+ }
+ },
+ {
+ u'info_dict': {
+ u'id': u'731567',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Ep. 11 Act 2',
+ u'description': u'Many rock academics have proclaimed that the truly progressive musicianship of the last 20 years has been found right here in the world of heavy metal, rather than obvious locales such as jazz, fusion or progressive rock. It stands to reason then, that much of this jaw-dropping virtuosity occurs within what\'s known as progressive metal, a genre that takes root with the likes of Rush in the \'70s, Queensryche and Fates Warning in the \'80s, and Dream Theater in the \'90s. Since then, the genre has exploded with creativity, spawning mind-bending, genre-defying acts such as Tool, Mastodon, Coheed And Cambria, Porcupine Tree, Meshuggah, A Perfect Circle and Opeth. Episode 11 looks at the extreme musicianship of these bands, as well as their often extreme literary prowess and conceptual strength, the end result being a rich level of respect and attention such challenging acts have brought upon the world of heavy metal, from a critical community usually dismissive of the form.'
+ }
+ },
+
+ {
+ u'info_dict': {
+ u'id': u'731568',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Ep. 11 Act 3',
+ u'description': u'Many rock academics have proclaimed that the truly progressive musicianship of the last 20 years has been found right here in the world of heavy metal, rather than obvious locales such as jazz, fusion or progressive rock. It stands to reason then, that much of this jaw-dropping virtuosity occurs within what\'s known as progressive metal, a genre that takes root with the likes of Rush in the \'70s, Queensryche and Fates Warning in the \'80s, and Dream Theater in the \'90s. Since then, the genre has exploded with creativity, spawning mind-bending, genre-defying acts such as Tool, Mastodon, Coheed And Cambria, Porcupine Tree, Meshuggah, A Perfect Circle and Opeth. Episode 11 looks at the extreme musicianship of these bands, as well as their often extreme literary prowess and conceptual strength, the end result being a rich level of respect and attention such challenging acts have brought upon the world of heavy metal, from a critical community usually dismissive of the form.'
+ }
+ },
+ {
+ u'info_dict': {
+ u'id': u'731569',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Ep. 11 Act 4',
+ u'description': u'Many rock academics have proclaimed that the truly progressive musicianship of the last 20 years has been found right here in the world of heavy metal, rather than obvious locales such as jazz, fusion or progressive rock. It stands to reason then, that much of this jaw-dropping virtuosity occurs within what\'s known as progressive metal, a genre that takes root with the likes of Rush in the \'70s, Queensryche and Fates Warning in the \'80s, and Dream Theater in the \'90s. Since then, the genre has exploded with creativity, spawning mind-bending, genre-defying acts such as Tool, Mastodon, Coheed And Cambria, Porcupine Tree, Meshuggah, A Perfect Circle and Opeth. Episode 11 looks at the extreme musicianship of these bands, as well as their often extreme literary prowess and conceptual strength, the end result being a rich level of respect and attention such challenging acts have brought upon the world of heavy metal, from a critical community usually dismissive of the form.'
+ }
+ },
+ {
+ u'info_dict': {
+ u'id': u'731570',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Ep. 11 Act 5',
+ u'description': u'Many rock academics have proclaimed that the truly progressive musicianship of the last 20 years has been found right here in the world of heavy metal, rather than obvious locales such as jazz, fusion or progressive rock. It stands to reason then, that much of this jaw-dropping virtuosity occurs within what\'s known as progressive metal, a genre that takes root with the likes of Rush in the \'70s, Queensryche and Fates Warning in the \'80s, and Dream Theater in the \'90s. Since then, the genre has exploded with creativity, spawning mind-bending, genre-defying acts such as Tool, Mastodon, Coheed And Cambria, Porcupine Tree, Meshuggah, A Perfect Circle and Opeth. Episode 11 looks at the extreme musicianship of these bands, as well as their often extreme literary prowess and conceptual strength, the end result being a rich level of respect and attention such challenging acts have brought upon the world of heavy metal, from a critical community usually dismissive of the form.'
+ }
+ }
+ ]
+ }
+ ]
+
+
+class VH1ClipIE(VH1IE):
+ _VALID_URL = r'https?://www\.vh1\.com/video/misc/.+?/.+?\.jhtml#id=(?P<videoid>[^/]+)$'
+ _TESTS = [
+ {
+ u'url': u'http://www.vh1.com/video/misc/706675/metal-evolution-episode-1-pre-metal-show-clip.jhtml#id=1674118',
+ u'info_dict': {
+ u'id': u'706675',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Episode 1 Pre-Metal Show Clip',
+ u'description': u'The greatest documentary ever made about Heavy Metal begins as our host Sam Dunn travels the globe to seek out the origins and influences that helped create Heavy Metal. Sam speaks to legends like Kirk Hammett, Alice Cooper, Slash, Bill Ward, Geezer Butler, Tom Morello, Ace Frehley, Lemmy Kilmister, Dave Davies, and many many more. This episode is the prologue for the 11 hour series, and Sam goes back to the very beginning to reveal how Heavy Metal was created.'
+ }
+ }
+ ]
+
+
+class VH1ShortUrlIE(VH1IE):
+ _VALID_URL = r'https?://www\.vh1\.com/video/play.jhtml\?id=(?P<videoid>[^/]+)$'
+ _TESTS = [
+ {
+ u'url': u'http://www.vh1.com/video/play.jhtml?id=1678353',
+ u'info_dict': {
+ u'id': u'730355',
+ u'ext': u'mp4',
+ u'title': u'Metal Evolution: Episode 11 Progressive Metal Sneak',
+ u'description': u'In Metal Evolution\'s finale sneak, Sam sits with Michael Giles of King Crimson and gets feedback from Metallica guitarist Kirk Hammett on why the group was influential.'
+ }
+ }
+ ]
+
+
+class VH1MusicVideoIE(VH1IE):
+ _VALID_URL = r'https?://www\.vh1\.com/video/.+?/(?P<videoid>[^/]+)/.+?$'
+ _TESTS = [
+ {
+ u'url': u'http://www.vh1.com/video/macklemore-ryan-lewis/900535/cant-hold-us-ft-ray-dalton.jhtml',
+ u'info_dict': {
+ u'id': u'900535',
+ u'ext': u'mp4',
+ u'title': u'Macklemore & Ryan Lewis - "Can\'t Hold Us ft. Ray Dalton"',
+ u'description': u'The Heist'
+ }
+ }
+ ]
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('videoid')
+ # difference from VH1IE._real_extract() is "vid" param instead of "id"
+ idoc = self._download_xml(
+ self._FEED_URL + '?vid=' + video_id, video_id,
+ 'Downloading info', transform_source=fix_xml_ampersands)
+ return [self._get_video_info(item) for item in idoc.findall('.//item')]