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.

63 lines
2.1 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. def _real_extract(self, url):
  24. video_id = self._match_id(url)
  25. webpage = self._download_webpage(url, video_id)
  26. stream_key = self._html_search_regex(
  27. r'''var\s+stream_key\s*=\s*['"](.+?)['"]''',
  28. webpage, 'stream key')
  29. formats = [{
  30. 'url': 'http://spankbang.com/_%s/%s/title/%sp__mp4' % (video_id, stream_key, height),
  31. 'ext': 'mp4',
  32. 'format_id': '%sp' % height,
  33. 'height': int(height),
  34. } for height in re.findall(r'<(?:span|li|p)[^>]+[qb]_(\d+)p', webpage)]
  35. self._check_formats(formats, video_id)
  36. self._sort_formats(formats)
  37. title = self._html_search_regex(
  38. r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
  39. description = self._og_search_description(webpage)
  40. thumbnail = self._og_search_thumbnail(webpage)
  41. uploader = self._search_regex(
  42. r'class="user"[^>]*><img[^>]+>([^<]+)',
  43. webpage, 'uploader', fatal=False)
  44. age_limit = self._rta_search(webpage)
  45. return {
  46. 'id': video_id,
  47. 'title': title,
  48. 'description': description,
  49. 'thumbnail': thumbnail,
  50. 'uploader': uploader,
  51. 'formats': formats,
  52. 'age_limit': age_limit,
  53. }