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.

65 lines
2.3 KiB

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