From c81313a79c986e128dd5b903c310c300670b8790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis?= Date: Fri, 13 May 2016 01:19:34 +0300 Subject: [PATCH] [amc] Add extractor for amc.com Closes #8636 --- youtube_dl/extractor/amc.py | 46 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 47 insertions(+) create mode 100644 youtube_dl/extractor/amc.py diff --git a/youtube_dl/extractor/amc.py b/youtube_dl/extractor/amc.py new file mode 100644 index 000000000..73ba10274 --- /dev/null +++ b/youtube_dl/extractor/amc.py @@ -0,0 +1,46 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + smuggle_url, + url_basename +) + + +class AMCIE(InfoExtractor): + IE_NAME = 'amc' + _VALID_URL = r'https?://www\.amc\.com/.*?' + _TESTS = [ + { + 'url': 'http://www.amc.com/shows/talking-bad/video-extras/episode-509-online-bonus-video-talking-bad', + 'md5': '0ee064a81e6043ae53d8d1fd8216a60f', + 'info_dict': { + 'id': 'JI4ZCEoT4cne', + 'ext': 'mp4', + 'title': 'Episode 509 Online Bonus Video: Talking Bad', + 'description': 'md5:b451732ab2bf70452a689e9024d81ba3', + 'timestamp': 1376324809, + 'upload_date': '20130812', + 'uploader': 'AMCN', + }, + 'add_ie': ['ThePlatform'] + } + ] + + def _real_extract(self, url): + name = url_basename(url) + webpage = self._download_webpage(url, name) + account_id = 'M_UwQC' + video_id = self._search_regex( + r"class='platform-container'[^>]+data-video-id='([^']+)'", + webpage, 'video_id') + + return { + '_type': 'url_transparent', + 'ie_key': 'ThePlatform', + 'url': smuggle_url( + 'http://link.theplatform.com/s/%s/media/%s?mbr=true' % (account_id, video_id), + {'force_smil_url': True}), + 'id': video_id + } + diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index f2bd4fe97..07f968b5b 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -21,6 +21,7 @@ from .aftonbladet import AftonbladetIE from .airmozilla import AirMozillaIE from .aljazeera import AlJazeeraIE from .alphaporno import AlphaPornoIE +from .amc import AMCIE from .animeondemand import AnimeOnDemandIE from .anitube import AnitubeIE from .anysex import AnySexIE