[extractor/moviepilot] Fix extractor (#5954)

Authored by: panatexxa
This commit is contained in:
panatexxa 2023-02-12 05:15:16 +01:00 committed by GitHub
parent c085cc2def
commit c62e64cf01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,5 @@
from .dailymotion import DailymotionIE from .dailymotion import DailymotionIE
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import (
parse_iso8601,
try_get,
)
import re
class MoviepilotIE(InfoExtractor): class MoviepilotIE(InfoExtractor):
@ -16,21 +10,21 @@ class MoviepilotIE(InfoExtractor):
_TESTS = [{ _TESTS = [{
'url': 'https://www.moviepilot.de/movies/interstellar-2/', 'url': 'https://www.moviepilot.de/movies/interstellar-2/',
'info_dict': { 'info_dict': {
'id': 'x7xdut5', 'id': 'x7xdpkk',
'display_id': 'interstellar-2', 'display_id': 'interstellar-2',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Interstellar', 'title': 'Interstellar',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaXev1VvzitVZMFsR/x720', 'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaV-q1ZganMw4HVXg/x1080',
'timestamp': 1400491705, 'timestamp': 1605010596,
'description': 'md5:7dfc5c1758e7322a7346934f1f0c489c', 'description': 'md5:0ae9cb452af52610c9ffc60f2fd0474c',
'uploader': 'Moviepilot', 'uploader': 'Moviepilot',
'like_count': int, 'like_count': int,
'view_count': int, 'view_count': int,
'uploader_id': 'x6nd9k', 'uploader_id': 'x6nd9k',
'upload_date': '20140519', 'upload_date': '20201110',
'duration': 140, 'duration': 97,
'age_limit': 0, 'age_limit': 0,
'tags': ['Alle Trailer', 'Movie', 'Third Party'], 'tags': ['Alle Trailer', 'Movie', 'Verleih'],
}, },
}, { }, {
'url': 'https://www.moviepilot.de/movies/interstellar-2/trailer', 'url': 'https://www.moviepilot.de/movies/interstellar-2/trailer',
@ -45,14 +39,14 @@ class MoviepilotIE(InfoExtractor):
'display_id': 'queen-slim', 'display_id': 'queen-slim',
'title': 'Queen & Slim', 'title': 'Queen & Slim',
'ext': 'mp4', 'ext': 'mp4',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SbUM71WtomSjVmI_q/x720', 'thumbnail': r're:https://\w+\.dmcdn\.net/v/SbUM71ZeG2N975lf2/x1080',
'timestamp': 1571838685, 'timestamp': 1605555825,
'description': 'md5:73058bcd030aa12d991e4280d65fbebe', 'description': 'md5:83228bb86f5367dd181447fdc4873989',
'uploader': 'Moviepilot', 'uploader': 'Moviepilot',
'like_count': int, 'like_count': int,
'view_count': int, 'view_count': int,
'uploader_id': 'x6nd9k', 'uploader_id': 'x6nd9k',
'upload_date': '20191023', 'upload_date': '20201116',
'duration': 138, 'duration': 138,
'age_limit': 0, 'age_limit': 0,
'tags': ['Movie', 'Verleih', 'Neue Trailer'], 'tags': ['Movie', 'Verleih', 'Neue Trailer'],
@ -72,12 +66,12 @@ class MoviepilotIE(InfoExtractor):
'display_id': 'muellers-buero', 'display_id': 'muellers-buero',
'title': 'Müllers Büro', 'title': 'Müllers Büro',
'ext': 'mp4', 'ext': 'mp4',
'description': 'md5:57501251c05cdc61ca314b7633e0312e', 'description': 'md5:4d23a8f4ca035196cd4523863c4fe5a4',
'timestamp': 1287584475, 'timestamp': 1604958457,
'age_limit': 0, 'age_limit': 0,
'duration': 82, 'duration': 82,
'upload_date': '20101020', 'upload_date': '20201109',
'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1WfAm1d6maq_/x720', 'thumbnail': r're:https://\w+\.dmcdn\.net/v/SaMes1Zg3lxLv9j5u/x1080',
'uploader': 'Moviepilot', 'uploader': 'Moviepilot',
'like_count': int, 'like_count': int,
'view_count': int, 'view_count': int,
@ -91,22 +85,13 @@ def _real_extract(self, url):
webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id) webpage = self._download_webpage(f'https://www.moviepilot.de/movies/{video_id}/trailer', video_id)
duration = try_get( clip = self._search_nextjs_data(webpage, video_id)['props']['initialProps']['pageProps']
re.match(r'P(?P<hours>\d+)H(?P<mins>\d+)M(?P<secs>\d+)S',
self._html_search_meta('duration', webpage, fatal=False) or ''),
lambda mobj: sum(float(x) * y for x, y in zip(mobj.groups(), (3600, 60, 1))))
# _html_search_meta is not used since we don't want name=description to match
description = self._html_search_regex(
'<meta[^>]+itemprop="description"[^>]+content="([^>"]+)"', webpage, 'description', fatal=False)
return { return {
'_type': 'url_transparent', '_type': 'url_transparent',
'ie_key': DailymotionIE.ie_key(), 'ie_key': DailymotionIE.ie_key(),
'display_id': video_id, 'display_id': video_id,
'title': self._og_search_title(webpage), 'title': clip.get('title'),
'url': self._html_search_meta('embedURL', webpage), 'url': f'https://www.dailymotion.com/video/{clip["videoRemoteId"]}',
'thumbnail': self._html_search_meta('thumbnailURL', webpage), 'description': clip.get('summary'),
'description': description,
'duration': duration,
'timestamp': parse_iso8601(self._html_search_meta('uploadDate', webpage), delimiter=' ')
} }