cliphunter.py 2.4 KB

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