]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/giga.py
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
5 from ..utils
import parse_duration
, parse_iso8601
, qualities
, str_to_int
8 class GigaIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?giga\.de/(?:[^/]+/)*(?P<id>[^/]+)'
11 'url': 'http://www.giga.de/filme/anime-awesome/trailer/anime-awesome-chihiros-reise-ins-zauberland-das-beste-kommt-zum-schluss/',
12 'md5': '6bc5535e945e724640664632055a584f',
15 'display_id': 'anime-awesome-chihiros-reise-ins-zauberland-das-beste-kommt-zum-schluss',
17 'title': 'Anime Awesome: Chihiros Reise ins Zauberland – Das Beste kommt zum Schluss',
18 'description': 'md5:afdf5862241aded4718a30dff6a57baf',
19 'thumbnail': r
're:^https?://.*\.jpg$',
21 'timestamp': 1414749706,
22 'upload_date': '20141031',
23 'uploader': 'Robin Schweiger',
27 'url': 'http://www.giga.de/games/channel/giga-top-montag/giga-topmontag-die-besten-serien-2014/',
28 'only_matching': True,
30 'url': 'http://www.giga.de/extra/netzkultur/videos/giga-games-tom-mats-robin-werden-eigene-wege-gehen-eine-ankuendigung/',
31 'only_matching': True,
33 'url': 'http://www.giga.de/tv/jonas-liest-spieletitel-eingedeutscht-episode-2/',
34 'only_matching': True,
37 def _real_extract(self
, url
):
38 display_id
= self
._match
_id
(url
)
40 webpage
= self
._download
_webpage
(url
, display_id
)
42 video_id
= self
._search
_regex
(
43 [r
'data-video-id="(\d+)"', r
'/api/video/jwplayer/#v=(\d+)'],
46 playlist
= self
._download
_json
(
47 'http://www.giga.de/api/syndication/video/video_id/%s/playlist.json?content=syndication/key/368b5f151da4ae05ced7fa296bdff65a/'
48 % video_id
, video_id
)[0]
50 quality
= qualities(['normal', 'hd720'])
53 for format_id
in itertools
.count(0):
54 fmt
= playlist
.get(compat_str(format_id
))
59 'format_id': '%s-%s' % (fmt
['quality'], fmt
['type'].split('/')[-1]),
60 'quality': quality(fmt
['quality']),
63 title
= self
._html
_search
_meta
(
64 'title', webpage
, 'title', fatal
=True)
65 description
= self
._html
_search
_meta
(
66 'description', webpage
, 'description')
67 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
69 duration
= parse_duration(self
._search
_regex
(
70 r
'(?s)(?:data-video-id="{0}"|data-video="[^"]*/api/video/jwplayer/#v={0}[^"]*")[^>]*>.+?<span class="duration">([^<]+)</span>'.format(video_id
),
71 webpage
, 'duration', fatal
=False))
73 timestamp
= parse_iso8601(self
._search
_regex
(
74 r
'datetime="([^"]+)"', webpage
, 'upload date', fatal
=False))
75 uploader
= self
._search
_regex
(
76 r
'class="author">([^<]+)</a>', webpage
, 'uploader', fatal
=False)
78 view_count
= str_to_int(self
._search
_regex
(
79 r
'<span class="views"><strong>([\d.,]+)</strong>',
80 webpage
, 'view count', fatal
=False))
84 'display_id': display_id
,
86 'description': description
,
87 'thumbnail': thumbnail
,
89 'timestamp': timestamp
,
91 'view_count': view_count
,