mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-18 08:16:10 +00:00
[Filmarkivet] Add extractor for Filmarkivet.se
https://github.com/yt-dlp/yt-dlp/issues/2885
This commit is contained in:
parent
3472227074
commit
76144ccf0f
2 changed files with 55 additions and 0 deletions
|
@ -372,6 +372,7 @@ from .filmon import (
|
|||
FilmOnIE,
|
||||
FilmOnChannelIE,
|
||||
)
|
||||
from .filmark import FilmarkIE
|
||||
from .filmweb import FilmwebIE
|
||||
from .firsttv import FirstTVIE
|
||||
from .fivemin import FiveMinIE
|
||||
|
|
54
youtube_dl/extractor/filmark.py
Normal file
54
youtube_dl/extractor/filmark.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
merge_dicts,
|
||||
parse_iso8601,
|
||||
)
|
||||
|
||||
|
||||
class FilmarkIE(InfoExtractor):
|
||||
IE_NAME = 'Filmarkivet.se'
|
||||
_VALID_URL = r'https?://www\.filmarkivet\.se/movies/(?P<id>[\w-]+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.filmarkivet.se/movies/paris-d-moll/',
|
||||
'md5': 'df02cadc719dcc63d43288366f037754',
|
||||
'info_dict': {
|
||||
'id': 'paris-d-moll',
|
||||
'ext': 'mp4',
|
||||
'upload_date': '20200602',
|
||||
'title': 'Paris d-moll',
|
||||
'description': 'md5:319e37ea5542293db37e1e13072fe330',
|
||||
'timestamp': 1591092663,
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
title = (
|
||||
self._html_search_regex(r'<title\b[^>]*>\s*([^<]*)</title\b', webpage, '<title>', fatal=False)
|
||||
or self._og_search_title(webpage, fatal=False)
|
||||
or self._html_search_meta('twitter:title', webpage, default=''))
|
||||
title = re.split(r'(\s*-)?\s*[Ff]ilmarkivet', title, 1)[0] or self._generic_title(url)
|
||||
|
||||
ld_json_info = self._search_json_ld(webpage, video_id, default={})
|
||||
|
||||
jwp_info = self._extract_jwplayer_data(webpage, video_id, require_title=False)
|
||||
|
||||
description = (
|
||||
self._og_search_description(webpage)
|
||||
or self._html_search_meta('twitter:description', webpage, default=None))
|
||||
timestamp = parse_iso8601(self._og_search_property('updated_time', webpage, default=None))
|
||||
|
||||
return merge_dicts(
|
||||
jwp_info, ld_json_info, {
|
||||
'title': title,
|
||||
'description': description,
|
||||
'timestamp': timestamp,
|
||||
})
|
Loading…
Reference in a new issue