]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/beeg.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class BeegIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?beeg\.com/(?P<id>\d+)'
13 'url': 'http://beeg.com/5416503',
14 'md5': '46c384def73b33dbc581262e5ee67cef',
18 'title': 'Sultry Striptease',
19 'description': 'md5:d22219c09da287c14bed3d6c37ce4bc2',
20 'timestamp': 1391813355,
21 'upload_date': '20140207',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
31 video
= self
._download
_json
(
32 'http://beeg.com/api/v1/video/%s' % video_id
, video_id
)
35 for format_id
, video_url
in video
.items():
38 height
= self
._search
_regex
(
39 r
'^(\d+)[pP]$', format_id
, 'height', default
=None)
43 'url': self
._proto
_relative
_url
(video_url
.replace('{DATA_MARKERS}', ''), 'http:'),
44 'format_id': format_id
,
45 'height': int(height
),
47 self
._sort
_formats
(formats
)
49 title
= video
['title']
50 video_id
= video
.get('id') or video_id
51 display_id
= video
.get('code')
52 description
= video
.get('desc')
54 timestamp
= parse_iso8601(video
.get('date'), ' ')
55 duration
= int_or_none(video
.get('duration'))
57 tags
= [tag
.strip() for tag
in video
['tags'].split(',')] if video
.get('tags') else None
61 'display_id': display_id
,
63 'description': description
,
64 'timestamp': timestamp
,