]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/tunepk.py
1 from .common
import InfoExtractor
2 from ..compat
import compat_str
10 class TunePkIE(InfoExtractor
):
14 (?:www\.)?tune\.pk/(?:video/|player/embed_player.php?.*?\bvid=)|
20 'url': 'https://tune.pk/video/6919541/maudie-2017-international-trailer-1-ft-ethan-hawke-sally-hawkins',
21 'md5': '0c537163b7f6f97da3c5dd1e3ef6dd55',
25 'title': 'Maudie (2017) | International Trailer # 1 ft Ethan Hawke, Sally Hawkins',
26 'description': 'md5:eb5a04114fafef5cec90799a93a2d09c',
27 'thumbnail': r
're:^https?://.*\.jpg$',
28 'timestamp': 1487327564,
29 'upload_date': '20170217',
30 'uploader': 'Movie Trailers',
35 'url': 'https://tune.pk/player/embed_player.php?vid=6919541&folder=2017/02/17/&width=600&height=350&autoplay=no',
36 'only_matching': True,
38 'url': 'https://embed.tune.pk/play/6919541?autoplay=no&ssl=yes&inline=true',
39 'only_matching': True,
42 def _real_extract(self
, url
):
43 video_id
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(
46 'https://tune.pk/video/%s' % video_id
, video_id
)
48 details
= self
._parse
_json
(
50 r
'new\s+TunePlayer\(({.+?})\)\s*;\s*\n', webpage
, 'tune player'),
53 video
= details
['video']
54 title
= video
.get('title') or self
._og
_search
_title
(
55 webpage
, default
=None) or self
._html
_search
_meta
(
56 'title', webpage
, 'title', fatal
=True)
58 formats
= self
._parse
_jwplayer
_formats
(
59 details
['player']['sources'], video_id
)
61 description
= self
._og
_search
_description
(
62 webpage
, default
=None) or self
._html
_search
_meta
(
63 'description', webpage
, 'description')
65 thumbnail
= video
.get('thumb') or self
._og
_search
_thumbnail
(
66 webpage
, default
=None) or self
._html
_search
_meta
(
67 'thumbnail', webpage
, 'thumbnail')
69 timestamp
= unified_timestamp(video
.get('date_added'))
71 video
, lambda x
: x
['uploader']['name'],
72 compat_str
) or self
._html
_search
_meta
('author', webpage
, 'author')
74 duration
= int_or_none(video
.get('duration'))
75 view_count
= int_or_none(video
.get('views'))
80 'description': description
,
81 'thumbnail': thumbnail
,
82 'timestamp': timestamp
,
85 'view_count': view_count
,