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.

45 lines
1.3 KiB

  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. compat_urllib_parse,
  5. ExtractorError,
  6. )
  7. class XNXXIE(InfoExtractor):
  8. _VALID_URL = r'^(?:https?://)?video\.xnxx\.com/video([0-9]+)/(.*)'
  9. VIDEO_URL_RE = r'flv_url=(.*?)&'
  10. VIDEO_TITLE_RE = r'<title>(.*?)\s+-\s+XNXX.COM'
  11. VIDEO_THUMB_RE = r'url_bigthumb=(.*?)&amp;'
  12. def _real_extract(self, url):
  13. mobj = re.match(self._VALID_URL, url)
  14. if mobj is None:
  15. raise ExtractorError(u'Invalid URL: %s' % url)
  16. video_id = mobj.group(1)
  17. # Get webpage content
  18. webpage = self._download_webpage(url, video_id)
  19. video_url = self._search_regex(self.VIDEO_URL_RE,
  20. webpage, u'video URL')
  21. video_url = compat_urllib_parse.unquote(video_url)
  22. video_title = self._html_search_regex(self.VIDEO_TITLE_RE,
  23. webpage, u'title')
  24. video_thumbnail = self._search_regex(self.VIDEO_THUMB_RE,
  25. webpage, u'thumbnail', fatal=False)
  26. return [{
  27. 'id': video_id,
  28. 'url': video_url,
  29. 'uploader': None,
  30. 'upload_date': None,
  31. 'title': video_title,
  32. 'ext': 'flv',
  33. 'thumbnail': video_thumbnail,
  34. 'description': None,
  35. }]