slutload.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from .common import InfoExtractor
  2. class SlutloadIE(InfoExtractor):
  3. _VALID_URL = r'https?://(?:\w+\.)?slutload\.com/(?:video/[^/]+|embed_player|watch)/(?P<id>[^/]+)'
  4. _TESTS = [{
  5. 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
  6. 'md5': '868309628ba00fd488cf516a113fd717',
  7. 'info_dict': {
  8. 'id': 'TD73btpBqSxc',
  9. 'ext': 'mp4',
  10. 'title': 'virginie baisee en cam',
  11. 'age_limit': 18,
  12. 'thumbnail': r're:https?://.*?\.jpg',
  13. },
  14. }, {
  15. # mobile site
  16. 'url': 'http://mobile.slutload.com/video/masturbation-solo/fviFLmc6kzJ/',
  17. 'only_matching': True,
  18. }, {
  19. 'url': 'http://www.slutload.com/embed_player/TD73btpBqSxc/',
  20. 'only_matching': True,
  21. }, {
  22. 'url': 'http://www.slutload.com/watch/TD73btpBqSxc/Virginie-Baisee-En-Cam.html',
  23. 'only_matching': True,
  24. }]
  25. def _real_extract(self, url):
  26. video_id = self._match_id(url)
  27. embed_page = self._download_webpage(
  28. f'http://www.slutload.com/embed_player/{video_id}', video_id,
  29. 'Downloading embed page', fatal=False)
  30. if embed_page:
  31. def extract(what):
  32. return self._html_search_regex(
  33. rf'data-video-{what}=(["\'])(?P<url>(?:(?!\1).)+)\1',
  34. embed_page, f'video {what}', default=None, group='url')
  35. video_url = extract('url')
  36. if video_url:
  37. title = self._html_search_regex(
  38. r'<title>([^<]+)', embed_page, 'title', default=video_id)
  39. return {
  40. 'id': video_id,
  41. 'url': video_url,
  42. 'title': title,
  43. 'thumbnail': extract('preview'),
  44. 'age_limit': 18,
  45. }
  46. webpage = self._download_webpage(
  47. f'http://www.slutload.com/video/_/{video_id}/', video_id)
  48. title = self._html_search_regex(
  49. r'<h1><strong>([^<]+)</strong>', webpage, 'title').strip()
  50. info = self._parse_html5_media_entries(url, webpage, video_id)[0]
  51. info.update({
  52. 'id': video_id,
  53. 'title': title,
  54. 'age_limit': 18,
  55. })
  56. return info