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.7 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class FoxgayIE(InfoExtractor):
  4. _VALID_URL = r'http://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P<id>\d+)\.shtml'
  5. _TEST = {
  6. 'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml',
  7. 'md5': '80d72beab5d04e1655a56ad37afe6841',
  8. 'info_dict': {
  9. 'id': '2582',
  10. 'ext': 'mp4',
  11. 'title': 'md5:6122f7ae0fc6b21ebdf59c5e083ce25a',
  12. 'description': 'md5:5e51dc4405f1fd315f7927daed2ce5cf',
  13. 'age_limit': 18,
  14. 'thumbnail': 're:https?://.*\.jpg$',
  15. },
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(url, video_id)
  20. title = self._html_search_regex(
  21. r'<title>(?P<title>.*?)</title>',
  22. webpage, 'title', fatal=False)
  23. description = self._html_search_regex(
  24. r'<div class="ico_desc"><h2>(?P<description>.*?)</h2>',
  25. webpage, 'description', fatal=False)
  26. # Find the URL for the iFrame which contains the actual video.
  27. iframe = self._download_webpage(
  28. self._html_search_regex(r'iframe src="(?P<frame>.*?)"', webpage, 'video frame'),
  29. video_id)
  30. video_url = self._html_search_regex(
  31. r"v_path = '(?P<vid>http://.*?)'", iframe, 'url')
  32. thumb_url = self._html_search_regex(
  33. r"t_path = '(?P<thumb>http://.*?)'", iframe, 'thumbnail', fatal=False)
  34. return {
  35. 'id': video_id,
  36. 'title': title,
  37. 'url': video_url,
  38. 'description': description,
  39. 'thumbnail': thumb_url,
  40. 'age_limit': 18,
  41. }