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.

79 lines
2.5 KiB

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