slutload.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. ExtractorError,
  5. )
  6. class SlutloadIE(InfoExtractor):
  7. _VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<videoid>[^/]+)/?$'
  8. _TEST = {
  9. u'url': u'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
  10. u'file': u'TD73btpBqSxc.mp4',
  11. u'md5': u'0cf531ae8006b530bd9df947a6a0df77',
  12. u'info_dict': {
  13. u"title": u"virginie baisee en cam",
  14. u"age_limit": 18,
  15. }
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('videoid')
  20. # Get webpage content
  21. webpage = self._download_webpage(url, video_id)
  22. # Get the video title
  23. video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
  24. webpage, u'title').strip()
  25. # Get the video url
  26. result = re.compile(r'<div id="vidPlayer"\s+data-url="([^"]+)"\s+previewer-file="([^"]+)"', re.S).search(webpage)
  27. if result is None:
  28. raise ExtractorError(u'ERROR: unable to extract video_url')
  29. video_url, video_thumb = result.group(1,2)
  30. info = {'id': video_id,
  31. 'url': video_url,
  32. 'title': video_title,
  33. 'thumbnail': video_thumb,
  34. 'ext': 'mp4',
  35. 'age_limit': 18}
  36. return [info]