]>
Commit | Line | Data |
---|---|---|
8646eb79 S |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
7ab7c9e9 NJ |
4 | import re |
5 | ||
8646eb79 | 6 | from .common import InfoExtractor |
895ba7d1 PH |
7 | from ..utils import ( |
8 | int_or_none, | |
9 | parse_duration, | |
10 | str_to_int, | |
11 | unified_strdate, | |
12 | ) | |
13 | ||
8646eb79 S |
14 | |
15 | class GameStarIE(InfoExtractor): | |
16 | _VALID_URL = r'http://www\.gamestar\.de/videos/.*,(?P<id>[0-9]+)\.html' | |
17 | _TEST = { | |
18 | 'url': 'http://www.gamestar.de/videos/trailer,3/hobbit-3-die-schlacht-der-fuenf-heere,76110.html', | |
19 | 'md5': '96974ecbb7fd8d0d20fca5a00810cea7', | |
20 | 'info_dict': { | |
21 | 'id': '76110', | |
22 | 'ext': 'mp4', | |
23 | 'title': 'Hobbit 3: Die Schlacht der Fünf Heere - Teaser-Trailer zum dritten Teil', | |
24 | 'description': 'Der Teaser-Trailer zu Hobbit 3: Die Schlacht der Fünf Heere zeigt einige Szenen aus dem dritten Teil der Saga und kündigt den vollständigen Trailer an.', | |
25 | 'thumbnail': 'http://images.gamestar.de/images/idgwpgsgp/bdb/2494525/600x.jpg', | |
26 | 'upload_date': '20140728', | |
27 | 'duration': 17 | |
28 | } | |
29 | } | |
30 | ||
31 | def _real_extract(self, url): | |
08ff6ab0 | 32 | video_id = self._match_id(url) |
8646eb79 S |
33 | webpage = self._download_webpage(url, video_id) |
34 | ||
35 | og_title = self._og_search_title(webpage) | |
7ab7c9e9 | 36 | title = re.sub(r'\s*- Video (bei|-) GameStar\.de$', '', og_title) |
8646eb79 S |
37 | |
38 | url = 'http://gamestar.de/_misc/videos/portal/getVideoUrl.cfm?premium=0&videoId=' + video_id | |
39 | ||
40 | description = self._og_search_description(webpage).strip() | |
41 | ||
895ba7d1 PH |
42 | thumbnail = self._proto_relative_url( |
43 | self._og_search_thumbnail(webpage), scheme='http:') | |
8646eb79 | 44 | |
895ba7d1 | 45 | upload_date = unified_strdate(self._html_search_regex( |
8646eb79 | 46 | r'<span style="float:left;font-size:11px;">Datum: ([0-9]+\.[0-9]+\.[0-9]+) ', |
895ba7d1 | 47 | webpage, 'upload_date', fatal=False)) |
8646eb79 | 48 | |
895ba7d1 PH |
49 | duration = parse_duration(self._html_search_regex( |
50 | r' Länge: ([0-9]+:[0-9]+)</span>', webpage, 'duration', | |
51 | fatal=False)) | |
8646eb79 | 52 | |
895ba7d1 PH |
53 | view_count = str_to_int(self._html_search_regex( |
54 | r' Zuschauer: ([0-9\.]+) ', webpage, | |
55 | 'view_count', fatal=False)) | |
8646eb79 | 56 | |
895ba7d1 PH |
57 | comment_count = int_or_none(self._html_search_regex( |
58 | r'>Kommentieren \(([0-9]+)\)</a>', webpage, 'comment_count', | |
59 | fatal=False)) | |
8646eb79 S |
60 | |
61 | return { | |
62 | 'id': video_id, | |
63 | 'title': title, | |
64 | 'url': url, | |
65 | 'ext': 'mp4', | |
66 | 'thumbnail': thumbnail, | |
67 | 'description': description, | |
68 | 'upload_date': upload_date, | |
69 | 'duration': duration, | |
70 | 'view_count': view_count, | |
71 | 'comment_count': comment_count | |
72 | } |