You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

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