]>
Commit | Line | Data |
---|---|---|
da1ffde1 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .dailymotion import DailymotionIE | |
5 | from .common import InfoExtractor | |
6 | from ..utils import ( | |
7 | parse_iso8601, | |
8 | try_get, | |
9 | ) | |
10 | ||
11 | import re | |
12 | ||
13 | ||
14 | class MoviepilotIE(InfoExtractor): | |
15 | _IE_NAME = 'moviepilot' | |
16 | _IE_DESC = 'Moviepilot trailer' | |
17 | _VALID_URL = r'https?://(?:www\.)?moviepilot\.de/movies/(?P<id>[^/]+)' | |
18 | ||
19 | _TESTS = [{ | |
20 | 'url': 'https://www.moviepilot.de/movies/interstellar-2/', | |
21 | 'info_dict': { | |
22 | 'id': 'x7xdut5', | |
23 | 'display_id': 'interstellar-2', | |
24 | 'ext': 'mp4', | |
25 | 'title': 'Interstellar', | |
26 | 'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaXev1VvzitVZMFsR/x720', | |
27 | 'timestamp': 1400491705, | |
28 | 'description': 'md5:7dfc5c1758e7322a7346934f1f0c489c', | |
29 | 'uploader': 'Moviepilot', | |
30 | 'like_count': int, | |
31 | 'view_count': int, | |
32 | 'uploader_id': 'x6nd9k', | |
33 | 'upload_date': '20140519', | |
34 | 'duration': 140, | |
35 | 'age_limit': 0, | |
36 | 'tags': ['Alle Trailer', 'Movie', 'Third Party'], | |
37 | }, | |
38 | }, { | |
39 | 'url': 'https://www.moviepilot.de/movies/interstellar-2/trailer', | |
40 | 'only_matching': True, | |
41 | }, { | |
42 | 'url': 'https://www.moviepilot.de/movies/interstellar-2/kinoprogramm/berlin', | |
43 | 'only_matching': True, | |
44 | }, { | |
45 | 'url': 'https://www.moviepilot.de/movies/queen-slim/trailer', | |
46 | 'info_dict': { | |
47 | 'id': 'x7xj6o7', | |
48 | 'display_id': 'queen-slim', | |
49 | 'title': 'Queen & Slim', | |
50 | 'ext': 'mp4', | |
51 | 'thumbnail': r're:https://\w+\.dmcdn\.net/v/SbUM71WtomSjVmI_q/x720', | |
52 | 'timestamp': 1571838685, | |
53 | 'description': 'md5:73058bcd030aa12d991e4280d65fbebe', | |
54 | 'uploader': 'Moviepilot', | |
55 | 'like_count': int, | |
56 | 'view_count': int, | |
57 | 'uploader_id': 'x6nd9k', | |
58 | 'upload_date': '20191023', | |
59 | 'duration': 138, | |
60 | 'age_limit': 0, | |
61 | 'tags': ['Movie', 'Verleih', 'Neue Trailer'], | |
62 | }, | |
63 | }, { | |
64 | 'url': 'https://www.moviepilot.de/movies/der-geiger-von-florenz/trailer', | |
65 | 'info_dict': { | |
66 | 'id': 'der-geiger-von-florenz', | |
67 | 'title': 'Der Geiger von Florenz', | |
68 | 'ext': 'mp4', | |
69 | }, | |
70 | 'skip': 'No trailer for this movie.', | |
71 | }, { | |
72 | 'url': 'https://www.moviepilot.de/movies/muellers-buero/', | |
73 | 'info_dict': { | |
74 | 'id': 'x7xcw1i', | |
75 | 'display_id': 'muellers-buero', | |
76 | 'title': 'Müllers Büro', | |
77 | 'ext': 'mp4', | |
78 | 'description': 'md5:57501251c05cdc61ca314b7633e0312e', | |
79 | 'timestamp': 1287584475, | |
80 | 'age_limit': 0, | |
81 | 'duration': 82, | |
82 | 'upload_date': '20101020', | |
83 | 'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1WfAm1d6maq_/x720', | |
84 | 'uploader': 'Moviepilot', | |
85 | 'like_count': int, | |
86 | 'view_count': int, | |
87 | 'tags': ['Alle Trailer', 'Movie', 'Verleih'], | |
88 | 'uploader_id': 'x6nd9k', | |
89 | }, | |
90 | }] | |
91 | ||
92 | def _real_extract(self, url): | |
93 | video_id = self._match_id(url) | |
94 | ||
95 | webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id) | |
96 | ||
97 | duration = try_get( | |
98 | re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S', | |
99 | self._html_search_meta('duration', webpage, fatal=False) or ''), | |
100 | lambda mobj: sum(float(x) * y for x, y in zip(mobj.groups(), (3600, 60, 1)))) | |
101 | # _html_search_meta is not used since we don't want name=description to match | |
102 | description = self._html_search_regex( | |
103 | '<meta[^>]+itemprop="description"[^>]+content="([^>"]+)"', webpage, 'description', fatal=False) | |
104 | ||
105 | return { | |
106 | '_type': 'url_transparent', | |
107 | 'ie_key': DailymotionIE.ie_key(), | |
108 | 'display_id': video_id, | |
109 | 'title': self._og_search_title(webpage), | |
110 | 'url': self._html_search_meta('embedURL', webpage), | |
111 | 'thumbnail': self._html_search_meta('thumbnailURL', webpage), | |
112 | 'description': description, | |
113 | 'duration': duration, | |
114 | 'timestamp': parse_iso8601(self._html_search_meta('uploadDate', webpage), delimiter=' ') | |
115 | } |