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.

48 lines
1.6 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..compat import compat_urllib_parse_unquote
  5. class XNXXIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:video|www)\.xnxx\.com/video-?(?P<id>[0-9a-z]+)/'
  7. _TESTS = [{
  8. 'url': 'http://www.xnxx.com/video-55awb78/skyrim_test_video',
  9. 'md5': 'ef7ecee5af78f8b03dca2cf31341d3a0',
  10. 'info_dict': {
  11. 'id': '55awb78',
  12. 'ext': 'flv',
  13. 'title': 'Skyrim Test Video',
  14. 'age_limit': 18,
  15. },
  16. }, {
  17. 'url': 'http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_',
  18. 'only_matching': True,
  19. }, {
  20. 'url': 'http://www.xnxx.com/video-55awb78/',
  21. 'only_matching': True,
  22. }]
  23. def _real_extract(self, url):
  24. video_id = self._match_id(url)
  25. webpage = self._download_webpage(url, video_id)
  26. video_url = self._search_regex(r'flv_url=(.*?)&amp;',
  27. webpage, 'video URL')
  28. video_url = compat_urllib_parse_unquote(video_url)
  29. video_title = self._html_search_regex(r'<title>(.*?)\s+-\s+XNXX.COM',
  30. webpage, 'title')
  31. video_thumbnail = self._search_regex(r'url_bigthumb=(.*?)&amp;',
  32. webpage, 'thumbnail', fatal=False)
  33. return {
  34. 'id': video_id,
  35. 'url': video_url,
  36. 'title': video_title,
  37. 'ext': 'flv',
  38. 'thumbnail': video_thumbnail,
  39. 'age_limit': 18,
  40. }