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. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. compat_urllib_parse,
  6. )
  7. class XVideosIE(InfoExtractor):
  8. _VALID_URL = r'^(?:https?://)?(?:www\.)?xvideos\.com/video([0-9]+)(?:.*)'
  9. _TEST = {
  10. 'url': 'http://www.xvideos.com/video939581/funny_porns_by_s_-1',
  11. 'file': '939581.flv',
  12. 'md5': '1d0c835822f0a71a7bf011855db929d0',
  13. 'info_dict': {
  14. "title": "Funny Porns By >>>>S<<<<<< -1",
  15. "age_limit": 18,
  16. }
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group(1)
  21. webpage = self._download_webpage(url, video_id)
  22. self.report_extraction(video_id)
  23. # Extract video URL
  24. video_url = compat_urllib_parse.unquote(
  25. self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL'))
  26. # Extract title
  27. video_title = self._html_search_regex(
  28. r'<title>(.*?)\s+-\s+XVID', webpage, 'title')
  29. # Extract video thumbnail
  30. video_thumbnail = self._search_regex(
  31. r'url_bigthumb=(.+?)&amp', webpage, 'thumbnail', fatal=False)
  32. return {
  33. 'id': video_id,
  34. 'url': video_url,
  35. 'uploader': None,
  36. 'upload_date': None,
  37. 'title': video_title,
  38. 'ext': 'flv',
  39. 'thumbnail': video_thumbnail,
  40. 'description': None,
  41. 'age_limit': 18,
  42. }