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.

56 lines
1.5 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. translation_table = {
  5. 'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
  6. 'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
  7. 'y': 'l', 'z': 'i',
  8. '$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
  9. }
  10. class CliphunterIE(InfoExtractor):
  11. IE_NAME = 'cliphunter'
  12. _VALID_URL = r'''(?x)http://(?:www\.)?cliphunter\.com/w/
  13. (?P<id>[0-9]+)/
  14. (?P<seo>.+?)(?:$|[#\?])
  15. '''
  16. _TEST = {
  17. 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
  18. 'file': '1012420.flv',
  19. 'md5': '15e7740f30428abf70f4223478dc1225',
  20. 'info_dict': {
  21. 'title': 'Fun Jynx Maze solo',
  22. }
  23. }
  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. pl_fiji = self._search_regex(
  29. r'pl_fiji = \'([^\']+)\'', webpage, 'video data')
  30. pl_c_qual = self._search_regex(
  31. r'pl_c_qual = "(.)"', webpage, 'video quality')
  32. video_title = self._search_regex(
  33. r'mediaTitle = "([^"]+)"', webpage, 'title')
  34. video_url = ''.join(translation_table.get(c, c) for c in pl_fiji)
  35. formats = [{
  36. 'url': video_url,
  37. 'format_id': pl_c_qual,
  38. }]
  39. return {
  40. 'id': video_id,
  41. 'title': video_title,
  42. 'formats': formats,
  43. }