]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/beeg.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
11 class BeegIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?beeg\.(?:com|porn(?:/video)?)/(?P<id>\d+)'
14 'url': 'http://beeg.com/5416503',
15 'md5': 'a1a1b1a8bc70a89e49ccfd113aed0820',
19 'title': 'Sultry Striptease',
20 'description': 'md5:d22219c09da287c14bed3d6c37ce4bc2',
21 'timestamp': 1391813355,
22 'upload_date': '20140207',
28 'url': 'https://beeg.porn/video/5416503',
29 'only_matching': True,
31 'url': 'https://beeg.porn/5416503',
32 'only_matching': True,
35 def _real_extract(self
, url
):
36 video_id
= self
._match
_id
(url
)
38 webpage
= self
._download
_webpage
(url
, video_id
)
40 beeg_version
= self
._search
_regex
(
41 r
'beeg_version\s*=\s*([\da-zA-Z_-]+)', webpage
, 'beeg version',
42 default
='1546225636701')
44 for api_path
in ('', 'api.'):
45 video
= self
._download
_json
(
46 'https://%sbeeg.com/api/v6/%s/video/%s'
47 % (api_path
, beeg_version
, video_id
), video_id
,
48 fatal
=api_path
== 'api.')
53 for format_id
, video_url
in video
.items():
56 height
= self
._search
_regex
(
57 r
'^(\d+)[pP]$', format_id
, 'height', default
=None)
61 'url': self
._proto
_relative
_url
(
62 video_url
.replace('{DATA_MARKERS}', 'data=pc_XX__%s_0' % beeg_version
), 'https:'),
63 'format_id': format_id
,
64 'height': int(height
),
66 self
._sort
_formats
(formats
)
68 title
= video
['title']
69 video_id
= compat_str(video
.get('id') or video_id
)
70 display_id
= video
.get('code')
71 description
= video
.get('desc')
72 series
= video
.get('ps_name')
74 timestamp
= unified_timestamp(video
.get('date'))
75 duration
= int_or_none(video
.get('duration'))
77 tags
= [tag
.strip() for tag
in video
['tags'].split(',')] if video
.get('tags') else None
81 'display_id': display_id
,
83 'description': description
,
85 'timestamp': timestamp
,
89 'age_limit': self
._rta
_search
(webpage
),