]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/beeg.py
c15a0ac8fdb28b95f9399a843b45322a44967bc0
   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, 
  36         'url': 'https://beeg.porn/video/5416503', 
  37         'only_matching': True, 
  39         'url': 'https://beeg.porn/5416503', 
  40         'only_matching': True, 
  43     def _real_extract(self
, url
): 
  44         video_id 
= self
._match
_id
(url
) 
  46         webpage 
= self
._download
_webpage
(url
, video_id
) 
  48         beeg_version 
= self
._search
_regex
( 
  49             r
'beeg_version\s*=\s*([\da-zA-Z_-]+)', webpage
, 'beeg version', 
  50             default
='1546225636701') 
  52         qs 
= compat_urlparse
.parse_qs(compat_urlparse
.urlparse(url
).query
) 
  53         t 
= qs
.get('t', [''])[0].split('-') 
  63         for api_path 
in ('', 'api.'): 
  64             video 
= self
._download
_json
( 
  65                 'https://%sbeeg.com/api/v6/%s/video/%s' 
  66                 % (api_path
, beeg_version
, video_id
), video_id
, 
  67                 fatal
=api_path 
== 'api.', query
=query
) 
  72         for format_id
, video_url 
in video
.items(): 
  75             height 
= self
._search
_regex
( 
  76                 r
'^(\d+)[pP]$', format_id
, 'height', default
=None) 
  80                 'url': self
._proto
_relative
_url
( 
  81                     video_url
.replace('{DATA_MARKERS}', 'data=pc_XX__%s_0' % beeg_version
), 'https:'), 
  82                 'format_id': format_id
, 
  83                 'height': int(height
), 
  85         self
._sort
_formats
(formats
) 
  87         title 
= video
['title'] 
  88         video_id 
= compat_str(video
.get('id') or video_id
) 
  89         display_id 
= video
.get('code') 
  90         description 
= video
.get('desc') 
  91         series 
= video
.get('ps_name') 
  93         timestamp 
= unified_timestamp(video
.get('date')) 
  94         duration 
= int_or_none(video
.get('duration')) 
  96         tags 
= [tag
.strip() for tag 
in video
['tags'].split(',')] if video
.get('tags') else None 
 100             'display_id': display_id
, 
 102             'description': description
, 
 104             'timestamp': timestamp
, 
 105             'duration': duration
, 
 108             'age_limit': self
._rta
_search
(webpage
),