]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pyvideo.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class PyvideoIE(InfoExtractor
):
10 _VALID_URL
= r
'http://(?:www\.)?pyvideo\.org/video/(?P<id>\d+)/(.*)'
14 'url': 'http://pyvideo.org/video/1737/become-a-logging-expert-in-30-minutes',
15 'md5': 'de317418c8bc76b1fd8633e4f32acbc6',
19 'title': 'Become a logging expert in 30 minutes',
20 'description': 'md5:9665350d466c67fb5b1598de379021f7',
21 'upload_date': '20130320',
22 'uploader': 'NextDayVideo',
23 'uploader_id': 'NextDayVideo',
25 'add_ie': ['Youtube'],
28 'url': 'http://pyvideo.org/video/2542/gloriajw-spotifywitherikbernhardsson182m4v',
29 'md5': '5fe1c7e0a8aa5570330784c847ff6d12',
33 'title': 'Gloriajw-SpotifyWithErikBernhardsson182',
38 def _real_extract(self
, url
):
39 mobj
= re
.match(self
._VALID
_URL
, url
)
40 video_id
= mobj
.group('id')
42 webpage
= self
._download
_webpage
(url
, video_id
)
44 m_youtube
= re
.search(r
'(https?://www\.youtube\.com/watch\?v=.*)', webpage
)
45 if m_youtube
is not None:
46 return self
.url_result(m_youtube
.group(1), 'Youtube')
48 title
= self
._html
_search
_regex
(
49 r
'<div class="section">.*?<h3(?:\s+class="[^"]*")?>([^>]+?)</h3>',
50 webpage
, 'title', flags
=re
.DOTALL
)
51 video_url
= self
._search
_regex
(
52 [r
'<source src="(.*?)"', r
'<dt>Download</dt>.*?<a href="(.+?)"'],
53 webpage
, 'video url', flags
=re
.DOTALL
)
57 'title': os
.path
.splitext(title
)[0],