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.

88 lines
2.8 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import int_or_none
  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. def _decode(s):
  11. return ''.join(_translation_table.get(c, c) for c in s)
  12. class CliphunterIE(InfoExtractor):
  13. IE_NAME = 'cliphunter'
  14. _VALID_URL = r'''(?x)https?://(?:www\.)?cliphunter\.com/w/
  15. (?P<id>[0-9]+)/
  16. (?P<seo>.+?)(?:$|[#\?])
  17. '''
  18. _TESTS = [{
  19. 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
  20. 'md5': 'b7c9bbd4eb3a226ab91093714dcaa480',
  21. 'info_dict': {
  22. 'id': '1012420',
  23. 'ext': 'flv',
  24. 'title': 'Fun Jynx Maze solo',
  25. 'thumbnail': 're:^https?://.*\.jpg$',
  26. 'age_limit': 18,
  27. },
  28. 'skip': 'Video gone',
  29. }, {
  30. 'url': 'http://www.cliphunter.com/w/2019449/ShesNew__My_booty_girlfriend_Victoria_Paradices_pussy_filled_with_jizz',
  31. 'md5': '55a723c67bfc6da6b0cfa00d55da8a27',
  32. 'info_dict': {
  33. 'id': '2019449',
  34. 'ext': 'mp4',
  35. 'title': 'ShesNew - My booty girlfriend, Victoria Paradice\'s pussy filled with jizz',
  36. 'thumbnail': 're:^https?://.*\.jpg$',
  37. 'age_limit': 18,
  38. },
  39. }]
  40. def _real_extract(self, url):
  41. video_id = self._match_id(url)
  42. webpage = self._download_webpage(url, video_id)
  43. video_title = self._search_regex(
  44. r'mediaTitle = "([^"]+)"', webpage, 'title')
  45. gexo_files = self._parse_json(
  46. self._search_regex(
  47. r'var\s+gexoFiles\s*=\s*({.+?});', webpage, 'gexo files'),
  48. video_id)
  49. formats = []
  50. for format_id, f in gexo_files.items():
  51. video_url = f.get('url')
  52. if not video_url:
  53. continue
  54. fmt = f.get('fmt')
  55. height = f.get('h')
  56. format_id = '%s_%sp' % (fmt, height) if fmt and height else format_id
  57. formats.append({
  58. 'url': _decode(video_url),
  59. 'format_id': format_id,
  60. 'width': int_or_none(f.get('w')),
  61. 'height': int_or_none(height),
  62. 'tbr': int_or_none(f.get('br')),
  63. })
  64. self._sort_formats(formats)
  65. thumbnail = self._search_regex(
  66. r"var\s+mov_thumb\s*=\s*'([^']+)';",
  67. webpage, 'thumbnail', fatal=False)
  68. return {
  69. 'id': video_id,
  70. 'title': video_title,
  71. 'formats': formats,
  72. 'age_limit': self._rta_search(webpage),
  73. 'thumbnail': thumbnail,
  74. }