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.

48 lines
1.5 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class SlutloadIE(InfoExtractor):
  5. _VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<id>[^/]+)/?$'
  6. _TESTS = [{
  7. 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
  8. 'md5': '868309628ba00fd488cf516a113fd717',
  9. 'info_dict': {
  10. 'id': 'TD73btpBqSxc',
  11. 'ext': 'mp4',
  12. 'title': 'virginie baisee en cam',
  13. 'age_limit': 18,
  14. 'thumbnail': r're:https?://.*?\.jpg'
  15. }
  16. }, {
  17. # mobile site
  18. 'url': 'http://mobile.slutload.com/video/masturbation-solo/fviFLmc6kzJ/',
  19. 'only_matching': True,
  20. }]
  21. def _real_extract(self, url):
  22. video_id = self._match_id(url)
  23. desktop_url = re.sub(r'^(https?://)mobile\.', r'\1', url)
  24. webpage = self._download_webpage(desktop_url, video_id)
  25. video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
  26. webpage, 'title').strip()
  27. video_url = self._html_search_regex(
  28. r'(?s)<div id="vidPlayer"\s+data-url="([^"]+)"',
  29. webpage, 'video URL')
  30. thumbnail = self._html_search_regex(
  31. r'(?s)<div id="vidPlayer"\s+.*?previewer-file="([^"]+)"',
  32. webpage, 'thumbnail', fatal=False)
  33. return {
  34. 'id': video_id,
  35. 'url': video_url,
  36. 'title': video_title,
  37. 'thumbnail': thumbnail,
  38. 'age_limit': 18
  39. }