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.

67 lines
2.3 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class SpankBangIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:(?:www|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video'
  6. _TESTS = [{
  7. 'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
  8. 'md5': '1cc433e1d6aa14bc376535b8679302f7',
  9. 'info_dict': {
  10. 'id': '3vvn',
  11. 'ext': 'mp4',
  12. 'title': 'fantasy solo',
  13. 'description': 'Watch fantasy solo free HD porn video - 05 minutes - dillion harper masturbates on a bed free adult movies.',
  14. 'thumbnail': r're:^https?://.*\.jpg$',
  15. 'uploader': 'silly2587',
  16. 'age_limit': 18,
  17. }
  18. }, {
  19. # 480p only
  20. 'url': 'http://spankbang.com/1vt0/video/solvane+gangbang',
  21. 'only_matching': True,
  22. }, {
  23. # no uploader
  24. 'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2',
  25. 'only_matching': True,
  26. }]
  27. def _real_extract(self, url):
  28. video_id = self._match_id(url)
  29. webpage = self._download_webpage(url, video_id)
  30. stream_key = self._html_search_regex(
  31. r'''var\s+stream_key\s*=\s*['"](.+?)['"]''',
  32. webpage, 'stream key')
  33. formats = [{
  34. 'url': 'http://spankbang.com/_%s/%s/title/%sp__mp4' % (video_id, stream_key, height),
  35. 'ext': 'mp4',
  36. 'format_id': '%sp' % height,
  37. 'height': int(height),
  38. } for height in re.findall(r'<(?:span|li|p)[^>]+[qb]_(\d+)p', webpage)]
  39. self._check_formats(formats, video_id)
  40. self._sort_formats(formats)
  41. title = self._html_search_regex(
  42. r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
  43. description = self._og_search_description(webpage)
  44. thumbnail = self._og_search_thumbnail(webpage)
  45. uploader = self._search_regex(
  46. r'class="user"[^>]*><img[^>]+>([^<]+)',
  47. webpage, 'uploader', default=None)
  48. age_limit = self._rta_search(webpage)
  49. return {
  50. 'id': video_id,
  51. 'title': title,
  52. 'description': description,
  53. 'thumbnail': thumbnail,
  54. 'uploader': uploader,
  55. 'formats': formats,
  56. 'age_limit': age_limit,
  57. }