]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/pyvideo.py
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
5 from ..utils
import int_or_none
8 class PyvideoIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?pyvideo\.org/(?P<category>[^/]+)/(?P<id>[^/?#&.]+)'
12 'url': 'http://pyvideo.org/pycon-us-2013/become-a-logging-expert-in-30-minutes.html',
14 'id': 'become-a-logging-expert-in-30-minutes',
18 'url': 'http://pyvideo.org/pygotham-2012/gloriajw-spotifywitherikbernhardsson182m4v.html',
19 'md5': '5fe1c7e0a8aa5570330784c847ff6d12',
23 'title': 'Gloriajw-SpotifyWithErikBernhardsson182.m4v',
27 def _real_extract(self
, url
):
28 mobj
= self
._match
_valid
_url
(url
)
29 category
= mobj
.group('category')
30 video_id
= mobj
.group('id')
34 data
= self
._download
_json
(
35 'https://raw.githubusercontent.com/pyvideo/data/master/%s/videos/%s.json'
36 % (category
, video_id
), video_id
, fatal
=False)
39 for video
in data
['videos']:
40 video_url
= video
.get('url')
42 if video
.get('type') == 'youtube':
43 entries
.append(self
.url_result(video_url
, 'Youtube'))
46 'id': compat_str(data
.get('id') or video_id
),
48 'title': data
['title'],
49 'description': data
.get('description') or data
.get('summary'),
50 'thumbnail': data
.get('thumbnail_url'),
51 'duration': int_or_none(data
.get('duration')),
54 webpage
= self
._download
_webpage
(url
, video_id
)
55 title
= self
._og
_search
_title
(webpage
)
56 media_urls
= self
._search
_regex
(
57 r
'(?s)Media URL:(.+?)</li>', webpage
, 'media urls')
59 r
'<a[^>]+href=(["\'])(?P
<url
>http
.+?
)\
1', media_urls):
60 media_url = m.group('url
')
61 if re.match(r'https?
://www\
.youtube\
.com
/watch
\?v
=.*', media_url):
62 entries.append(self.url_result(media_url, 'Youtube
'))
70 return self.playlist_result(entries, video_id)