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.

53 lines
1.5 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. _TEST = {
  13. u'url': u'http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_',
  14. u'file': u'1135332.flv',
  15. u'md5': u'0831677e2b4761795f68d417e0b7b445',
  16. u'info_dict': {
  17. u"title": u"lida \u00bb Naked Funny Actress (5)"
  18. }
  19. }
  20. def _real_extract(self, url):
  21. mobj = re.match(self._VALID_URL, url)
  22. if mobj is None:
  23. raise ExtractorError(u'Invalid URL: %s' % url)
  24. video_id = mobj.group(1)
  25. # Get webpage content
  26. webpage = self._download_webpage(url, video_id)
  27. video_url = self._search_regex(self.VIDEO_URL_RE,
  28. webpage, u'video URL')
  29. video_url = compat_urllib_parse.unquote(video_url)
  30. video_title = self._html_search_regex(self.VIDEO_TITLE_RE,
  31. webpage, u'title')
  32. video_thumbnail = self._search_regex(self.VIDEO_THUMB_RE,
  33. webpage, u'thumbnail', fatal=False)
  34. return [{
  35. 'id': video_id,
  36. 'url': video_url,
  37. 'uploader': None,
  38. 'upload_date': None,
  39. 'title': video_title,
  40. 'ext': 'flv',
  41. 'thumbnail': video_thumbnail,
  42. 'description': None,
  43. }]