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.

55 lines
1.6 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|www)\.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. u"age_limit": 18,
  19. }
  20. }
  21. def _real_extract(self, url):
  22. mobj = re.match(self._VALID_URL, url)
  23. if mobj is None:
  24. raise ExtractorError(u'Invalid URL: %s' % url)
  25. video_id = mobj.group(1)
  26. # Get webpage content
  27. webpage = self._download_webpage(url, video_id)
  28. video_url = self._search_regex(self.VIDEO_URL_RE,
  29. webpage, u'video URL')
  30. video_url = compat_urllib_parse.unquote(video_url)
  31. video_title = self._html_search_regex(self.VIDEO_TITLE_RE,
  32. webpage, u'title')
  33. video_thumbnail = self._search_regex(self.VIDEO_THUMB_RE,
  34. webpage, u'thumbnail', fatal=False)
  35. return [{
  36. 'id': video_id,
  37. 'url': video_url,
  38. 'uploader': None,
  39. 'upload_date': None,
  40. 'title': video_title,
  41. 'ext': 'flv',
  42. 'thumbnail': video_thumbnail,
  43. 'description': None,
  44. 'age_limit': 18,
  45. }]