]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/funnyordie.py
3 from .common
import InfoExtractor
6 class FunnyOrDieIE(InfoExtractor
):
7 _VALID_URL
= r
'^(?:https?://)?(?:www\.)?funnyordie\.com/videos/(?P<id>[0-9a-f]+)/.*$'
9 def _real_extract(self
, url
):
10 mobj
= re
.match(self
._VALID
_URL
, url
)
12 video_id
= mobj
.group('id')
13 webpage
= self
._download
_webpage
(url
, video_id
)
15 video_url
= self
._html
_search
_regex
(r
'<video[^>]*>\s*<source[^>]*>\s*<source src="(?P<url>[^"]+)"',
16 webpage
, u
'video URL', flags
=re
.DOTALL
)
18 title
= self
._html
_search
_regex
((r
"<h1 class='player_page_h1'.*?>(?P<title>.*?)</h1>",
19 r
'<title>(?P<title>[^<]+?)</title>'), webpage
, 'title', flags
=re
.DOTALL
)
21 video_description
= self
._html
_search
_regex
(r
'<meta property="og:description" content="(?P<desc>.*?)"',
22 webpage
, u
'description', fatal
=False, flags
=re
.DOTALL
)
29 'description': video_description
,