]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/southparkstudios.py
Update changelog.
[youtubedl] / youtube_dl / extractor / southparkstudios.py
1 import re
2
3 from .mtv import MTVIE, _media_xml_tag
4
5
6 class SouthParkStudiosIE(MTVIE):
7 IE_NAME = u'southparkstudios.com'
8 _VALID_URL = r'https?://www\.southparkstudios\.com/(clips|full-episodes)/(?P<id>.+?)(\?|#|$)'
9
10 _FEED_URL = 'http://www.southparkstudios.com/feeds/video-player/mrss'
11
12 _TEST = {
13 u'url': u'http://www.southparkstudios.com/clips/104437/bat-daded#tab=featured',
14 u'file': u'a7bff6c2-ed00-11e0-aca6-0026b9414f30.mp4',
15 u'info_dict': {
16 u'title': u'Bat Daded',
17 u'description': u'Randy disqualifies South Park by getting into a fight with Bat Dad.',
18 },
19 }
20
21 # Overwrite MTVIE properties we don't want
22 _TESTS = []
23
24 def _get_thumbnail_url(self, uri, itemdoc):
25 search_path = '%s/%s' % (_media_xml_tag('group'), _media_xml_tag('thumbnail'))
26 thumb_node = itemdoc.find(search_path)
27 if thumb_node is None:
28 return None
29 else:
30 return thumb_node.attrib['url']
31
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
34 video_id = mobj.group('id')
35 webpage = self._download_webpage(url, video_id)
36 mgid = self._search_regex(r'swfobject.embedSWF\(".*?(mgid:.*?)"',
37 webpage, u'mgid')
38 return self._get_videos_info(mgid)