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.

51 lines
1.5 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..compat import (
  5. compat_parse_qs,
  6. )
  7. from ..utils import (
  8. parse_duration,
  9. )
  10. class GoshgayIE(InfoExtractor):
  11. _VALID_URL = r'https?://(?:www\.)?goshgay\.com/video(?P<id>\d+?)($|/)'
  12. _TEST = {
  13. 'url': 'http://www.goshgay.com/video299069/diesel_sfw_xxx_video',
  14. 'md5': '4b6db9a0a333142eb9f15913142b0ed1',
  15. 'info_dict': {
  16. 'id': '299069',
  17. 'ext': 'flv',
  18. 'title': 'DIESEL SFW XXX Video',
  19. 'thumbnail': 're:^http://.*\.jpg$',
  20. 'duration': 80,
  21. 'age_limit': 18,
  22. }
  23. }
  24. def _real_extract(self, url):
  25. video_id = self._match_id(url)
  26. webpage = self._download_webpage(url, video_id)
  27. title = self._html_search_regex(
  28. r'<h2>(.*?)<', webpage, 'title')
  29. duration = parse_duration(self._html_search_regex(
  30. r'<span class="duration">\s*-?\s*(.*?)</span>',
  31. webpage, 'duration', fatal=False))
  32. flashvars = compat_parse_qs(self._html_search_regex(
  33. r'<embed.+?id="flash-player-embed".+?flashvars="([^"]+)"',
  34. webpage, 'flashvars'))
  35. thumbnail = flashvars.get('url_bigthumb', [None])[0]
  36. video_url = flashvars['flv_url'][0]
  37. return {
  38. 'id': video_id,
  39. 'url': video_url,
  40. 'title': title,
  41. 'thumbnail': thumbnail,
  42. 'duration': duration,
  43. 'age_limit': 18,
  44. }