]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/foxgay.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   6 class FoxgayIE(InfoExtractor
): 
   7     _VALID_URL 
= r
'http://(?:www\.)?foxgay\.com/videos/(?:\S+-)?(?P<id>\d+)\.shtml' 
   9         'url': 'http://foxgay.com/videos/fuck-turkish-style-2582.shtml', 
  10         'md5': '80d72beab5d04e1655a56ad37afe6841', 
  14             'title': 'md5:6122f7ae0fc6b21ebdf59c5e083ce25a', 
  15             'description': 'md5:5e51dc4405f1fd315f7927daed2ce5cf', 
  17             'thumbnail': 're:https?://.*\.jpg$', 
  21     def _real_extract(self
, url
): 
  22         video_id 
= self
._match
_id
(url
) 
  23         webpage 
= self
._download
_webpage
(url
, video_id
) 
  25         title 
= self
._html
_search
_regex
( 
  26             r
'<title>(?P<title>.*?)</title>', 
  27             webpage
, 'title', fatal
=False) 
  28         description 
= self
._html
_search
_regex
( 
  29             r
'<div class="ico_desc"><h2>(?P<description>.*?)</h2>', 
  30             webpage
, 'description', fatal
=False) 
  32         # Find the URL for the iFrame which contains the actual video. 
  33         iframe 
= self
._download
_webpage
( 
  34             self
._html
_search
_regex
(r
'iframe src="(?P<frame>.*?)"', webpage
, 'video frame'), 
  36         video_url 
= self
._html
_search
_regex
( 
  37             r
"v_path = '(?P<vid>http://.*?)'", iframe
, 'url') 
  38         thumb_url 
= self
._html
_search
_regex
( 
  39             r
"t_path = '(?P<thumb>http://.*?)'", iframe
, 'thumbnail', fatal
=False) 
  45             'description': description
, 
  46             'thumbnail': thumb_url
,