]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/giga.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
16 class GigaIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?giga\.de/(?:[^/]+/)*(?P<id>[^/]+)'
19 'url': 'http://www.giga.de/filme/anime-awesome/trailer/anime-awesome-chihiros-reise-ins-zauberland-das-beste-kommt-zum-schluss/',
20 'md5': '6bc5535e945e724640664632055a584f',
23 'display_id': 'anime-awesome-chihiros-reise-ins-zauberland-das-beste-kommt-zum-schluss',
25 'title': 'Anime Awesome: Chihiros Reise ins Zauberland – Das Beste kommt zum Schluss',
26 'description': 'md5:afdf5862241aded4718a30dff6a57baf',
27 'thumbnail': 're:^https?://.*\.jpg$',
29 'timestamp': 1414749706,
30 'upload_date': '20141031',
31 'uploader': 'Robin Schweiger',
35 'url': 'http://www.giga.de/games/channel/giga-top-montag/giga-topmontag-die-besten-serien-2014/',
36 'only_matching': True,
38 'url': 'http://www.giga.de/extra/netzkultur/videos/giga-games-tom-mats-robin-werden-eigene-wege-gehen-eine-ankuendigung/',
39 'only_matching': True,
41 'url': 'http://www.giga.de/tv/jonas-liest-spieletitel-eingedeutscht-episode-2/',
42 'only_matching': True,
45 def _real_extract(self
, url
):
46 display_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, display_id
)
50 video_id
= self
._search
_regex
(
51 [r
'data-video-id="(\d+)"', r
'/api/video/jwplayer/#v=(\d+)'],
54 playlist
= self
._download
_json
(
55 'http://www.giga.de/api/syndication/video/video_id/%s/playlist.json?content=syndication/key/368b5f151da4ae05ced7fa296bdff65a/'
56 % video_id
, video_id
)[0]
58 quality
= qualities(['normal', 'hd720'])
61 for format_id
in itertools
.count(0):
62 fmt
= playlist
.get(compat_str(format_id
))
67 'format_id': '%s-%s' % (fmt
['quality'], fmt
['type'].split('/')[-1]),
68 'quality': quality(fmt
['quality']),
70 self
._sort
_formats
(formats
)
72 title
= self
._html
_search
_meta
(
73 'title', webpage
, 'title', fatal
=True)
74 description
= self
._html
_search
_meta
(
75 'description', webpage
, 'description')
76 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
78 duration
= parse_duration(self
._search
_regex
(
79 r
'(?s)(?:data-video-id="{0}"|data-video="[^"]*/api/video/jwplayer/#v={0}[^"]*")[^>]*>.+?<span class="duration">([^<]+)</span>'.format(video_id
),
80 webpage
, 'duration', fatal
=False))
82 timestamp
= parse_iso8601(self
._search
_regex
(
83 r
'datetime="([^"]+)"', webpage
, 'upload date', fatal
=False))
84 uploader
= self
._search
_regex
(
85 r
'class="author">([^<]+)</a>', webpage
, 'uploader', fatal
=False)
87 view_count
= str_to_int(self
._search
_regex
(
88 r
'<span class="views"><strong>([\d.]+)</strong>', webpage
, 'view count', fatal
=False))
92 'display_id': display_id
,
94 'description': description
,
95 'thumbnail': thumbnail
,
97 'timestamp': timestamp
,
99 'view_count': view_count
,