mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-10-02 15:21:23 +02:00
Compare commits
12 Commits
dd4c0a27b2
...
7995ff155b
Author | SHA1 | Date | |
---|---|---|---|
|
7995ff155b | ||
|
fa3f206e18 | ||
|
6e0c2ee7b0 | ||
|
7019f2530a | ||
|
4cb7edddcd | ||
|
b94cb64caa | ||
|
9274444b9a | ||
|
562aae4db2 | ||
|
ff6b64e765 | ||
|
e4b16383d8 | ||
|
74b9bfcb1d | ||
|
b9aa2b5604 |
|
@ -1,10 +1,10 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import determine_ext, merge_dicts, unified_timestamp
|
from ..utils import merge_dicts, unified_timestamp, url_or_none
|
||||||
from ..utils.traversal import traverse_obj
|
from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class ZetlandDKArticleIE(InfoExtractor):
|
class ZetlandDKArticleIE(InfoExtractor):
|
||||||
_VALID_URL = r'https://www.zetland.dk/\w+/(?P<id>(?P<story_id>\w{8})-(?P<uploader_id>\w{8})-(?:\w{5}))'
|
_VALID_URL = r'https?://www\.zetland\.dk/\w+/(?P<id>(?P<story_id>\w{8})-(?P<uploader_id>\w{8})-(?:\w{5}))'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.zetland.dk/historie/sO9aq2MY-a81VP3BY-66e69?utm_source=instagram&utm_medium=linkibio&utm_campaign=artikel',
|
'url': 'https://www.zetland.dk/historie/sO9aq2MY-a81VP3BY-66e69?utm_source=instagram&utm_medium=linkibio&utm_campaign=artikel',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -19,7 +19,7 @@ class ZetlandDKArticleIE(InfoExtractor):
|
||||||
'uploader_url': 'https://www.zetland.dk/skribent/a81VP3BY',
|
'uploader_url': 'https://www.zetland.dk/skribent/a81VP3BY',
|
||||||
'uploader': 'Helle Fuusager',
|
'uploader': 'Helle Fuusager',
|
||||||
'release_date': '20240116',
|
'release_date': '20240116',
|
||||||
'thumbnail': 'https://zetland.imgix.net/2aafe500-b14e-11ee-bf83-65d5e1283a57/Zetland_Image_1.jpg?fit=crop&crop=focalpoint&auto=format,compress&cs=srgb&fp-x=0.49421296296296297&fp-y=0.48518518518518516&w=1200&h=630',
|
'thumbnail': r're:https://zetland\.imgix\.net/2aafe500-b14e-11ee-bf83-65d5e1283a57/Zetland_Image_1\.jpg',
|
||||||
'description': 'md5:9619d426772c133f5abb26db27f26a01',
|
'description': 'md5:9619d426772c133f5abb26db27f26a01',
|
||||||
'timestamp': 1705377592,
|
'timestamp': 1705377592,
|
||||||
'series_id': '62d54630-e87b-4ab1-a255-8de58dbe1b14',
|
'series_id': '62d54630-e87b-4ab1-a255-8de58dbe1b14',
|
||||||
|
@ -35,11 +35,10 @@ class ZetlandDKArticleIE(InfoExtractor):
|
||||||
story_data = traverse_obj(next_js_data, ('initialState', 'consume', 'story', 'story'))
|
story_data = traverse_obj(next_js_data, ('initialState', 'consume', 'story', 'story'))
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for audio_url in traverse_obj(story_data, ('story_content', 'meta', 'audioFiles', ...)):
|
for audio_url in traverse_obj(story_data, ('story_content', 'meta', 'audioFiles', ..., {url_or_none})):
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': audio_url,
|
'url': audio_url,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
'ext': determine_ext(audio_url)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return merge_dicts({
|
return merge_dicts({
|
||||||
|
@ -47,27 +46,26 @@ class ZetlandDKArticleIE(InfoExtractor):
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'uploader_id': uploader_id
|
'uploader_id': uploader_id
|
||||||
}, traverse_obj(story_data, {
|
}, traverse_obj(story_data, {
|
||||||
'title': ('story_content', 'content', 'title') or 'title',
|
'title': ((('story_content', 'content', 'title'), 'title'), {str}),
|
||||||
'uploader': ('sharer', 'name'),
|
'uploader': ('sharer', 'name'),
|
||||||
'uploader_id': ('sharer', 'sharer_id'),
|
'uploader_id': ('sharer', 'sharer_id'),
|
||||||
'description': ('story_content', 'content', 'sosialDescription'),
|
'description': ('story_content', 'content', 'socialDescription'),
|
||||||
'series_id': ('story_content', 'meta', 'seriesId'),
|
'series_id': ('story_content', 'meta', 'seriesId'),
|
||||||
'release_timestamp': ('published_at', {unified_timestamp}),
|
'release_timestamp': ('published_at', {unified_timestamp}),
|
||||||
'modified_timestamp': ('revised_at', {unified_timestamp}),
|
'modified_timestamp': ('revised_at', {unified_timestamp}),
|
||||||
}), traverse_obj(next_js_data, ('metaInfo', {
|
}, get_all=False), traverse_obj(next_js_data, ('metaInfo', {
|
||||||
'title': ('meta', 'title') or ('ld', 'headline') or ('og', 'og:title') or ('og', 'twitter:title'),
|
'title': ((('meta', 'title'), ('ld', 'headline'), ('og', 'og:title'), ('og', 'twitter:title')), {str}),
|
||||||
'description': (('meta', 'description') or ('ld', 'description')
|
'description': ((('meta', 'description'), ('ld', 'description'), ('og', 'og:description'), ('og', 'twitter:description')), {str}),
|
||||||
or ('og', 'og:description') or ('og', 'twitter:description')),
|
'uploader': ((('meta', 'author'), ('ld', 'author', 'name')), {str}),
|
||||||
'uploader': ('meta', 'author') or ('ld', 'author', 'name'),
|
'uploader_url': ('ld', 'author', 'url', {url_or_none}),
|
||||||
'uploader_url': ('ld', 'author', 'url'),
|
'thumbnail': ((('ld', 'image'), ('og', 'og:image'), ('og', 'twitter:image')), {url_or_none}),
|
||||||
'thumbnail': ('ld', 'image') or ('og', 'og:image') or ('og', 'twitter:image'),
|
|
||||||
'modified_timestamp': ('ld', 'dateModified', {unified_timestamp}),
|
'modified_timestamp': ('ld', 'dateModified', {unified_timestamp}),
|
||||||
'release_timestamp': ('ld', 'datePublished', {unified_timestamp}),
|
'release_timestamp': ('ld', 'datePublished', {unified_timestamp}),
|
||||||
'timestamp': ('ld', 'dateCreated', {unified_timestamp}),
|
'timestamp': ('ld', 'dateCreated', {unified_timestamp}),
|
||||||
})), {
|
}), get_all=False), {
|
||||||
'title': self._html_search_meta(['title', 'og:title', 'twitter:title'], webpage),
|
'title': self._html_search_meta(['title', 'og:title', 'twitter:title'], webpage),
|
||||||
'description': self._html_search_meta(['description', 'og:description', 'twitter:description'], webpage),
|
'description': self._html_search_meta(['description', 'og:description', 'twitter:description'], webpage),
|
||||||
'thumbnail': self._html_search_meta(['og:image', 'twitter:image'], webpage),
|
'thumbnail': self._html_search_meta(['og:image', 'twitter:image'], webpage),
|
||||||
'uploader': self._html_search_meta(['author'], webpage),
|
'uploader': self._html_search_meta(['author'], webpage),
|
||||||
'release_timestamp': unified_timestamp(self._html_search_meta(['article:published_time'], webpage)),
|
'release_timestamp': unified_timestamp(self._html_search_meta(['article:published_time'], webpage)),
|
||||||
}, self._search_json_ld(webpage, display_id))
|
}, self._search_json_ld(webpage, display_id, fatal=False))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user