]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/southparkstudios.py
[SouthParkStudiosIE] Also detect urls without http:// or www
[yt-dlp.git] / youtube_dl / extractor / southparkstudios.py
CommitLineData
5a6fecc3
JMF
1import re
2
3from .mtv import MTVIE, _media_xml_tag
4
5
6class SouthParkStudiosIE(MTVIE):
7 IE_NAME = u'southparkstudios.com'
90b6bbc3 8 _VALID_URL = r'(https?://)?(www\.)?(?P<url>southparkstudios\.com/(clips|full-episodes)/(?P<id>.+?)(\?|#|$))'
5a6fecc3
JMF
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',
e80d8610 17 u'description': u'Randy disqualifies South Park by getting into a fight with Bat Dad.',
5a6fecc3
JMF
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'))
69b227a9
JMF
26 thumb_node = itemdoc.find(search_path)
27 if thumb_node is None:
28 return None
29 else:
30 return thumb_node.attrib['url']
5a6fecc3
JMF
31
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
90b6bbc3 34 url = u'http://www.' + mobj.group(u'url')
5a6fecc3
JMF
35 video_id = mobj.group('id')
36 webpage = self._download_webpage(url, video_id)
e80d8610 37 mgid = self._search_regex(r'swfobject.embedSWF\(".*?(mgid:.*?)"',
5a6fecc3
JMF
38 webpage, u'mgid')
39 return self._get_videos_info(mgid)