]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/beeg.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
14 class BeegIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?beeg\.(?:com|porn(?:/video)?)/(?P<id>\d+)'
18 'url': 'http://beeg.com/5416503',
19 'md5': 'a1a1b1a8bc70a89e49ccfd113aed0820',
23 'title': 'Sultry Striptease',
24 'description': 'md5:d22219c09da287c14bed3d6c37ce4bc2',
25 'timestamp': 1391813355,
26 'upload_date': '20140207',
33 'url': 'https://beeg.com/1941093077?t=911-1391',
34 'only_matching': True,
37 'url': 'https://beeg.com/1277207756',
38 'only_matching': True,
40 'url': 'https://beeg.porn/video/5416503',
41 'only_matching': True,
43 'url': 'https://beeg.porn/5416503',
44 'only_matching': True,
47 def _real_extract(self
, url
):
48 video_id
= self
._match
_id
(url
)
50 webpage
= self
._download
_webpage
(url
, video_id
)
52 beeg_version
= self
._search
_regex
(
53 r
'beeg_version\s*=\s*([\da-zA-Z_-]+)', webpage
, 'beeg version',
54 default
='1546225636701')
56 if len(video_id
) >= 10:
60 qs
= compat_urlparse
.parse_qs(compat_urlparse
.urlparse(url
).query
)
61 t
= qs
.get('t', [''])[0].split('-')
70 for api_path
in ('', 'api.'):
71 video
= self
._download
_json
(
72 'https://%sbeeg.com/api/v6/%s/video/%s'
73 % (api_path
, beeg_version
, video_id
), video_id
,
74 fatal
=api_path
== 'api.', query
=query
)
79 for format_id
, video_url
in video
.items():
82 height
= self
._search
_regex
(
83 r
'^(\d+)[pP]$', format_id
, 'height', default
=None)
87 'url': self
._proto
_relative
_url
(
88 video_url
.replace('{DATA_MARKERS}', 'data=pc_XX__%s_0' % beeg_version
), 'https:'),
89 'format_id': format_id
,
90 'height': int(height
),
92 self
._sort
_formats
(formats
)
94 title
= video
['title']
95 video_id
= compat_str(video
.get('id') or video_id
)
96 display_id
= video
.get('code')
97 description
= video
.get('desc')
98 series
= video
.get('ps_name')
100 timestamp
= unified_timestamp(video
.get('date'))
101 duration
= int_or_none(video
.get('duration'))
103 tags
= [tag
.strip() for tag
in video
['tags'].split(',')] if video
.get('tags') else None
107 'display_id': display_id
,
109 'description': description
,
111 'timestamp': timestamp
,
112 'duration': duration
,
115 'age_limit': self
._rta
_search
(webpage
),