mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-07-01 07:49:52 +00:00
Compare commits
No commits in common. "cdbfe3a79311078ec73753763b34570332448f06" and "44ed9058e9145f3a346768eeec48c62cc922d3d9" have entirely different histories.
cdbfe3a793
...
44ed9058e9
@ -13,7 +13,6 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
UserNotLive,
|
UserNotLive,
|
||||||
clean_html,
|
clean_html,
|
||||||
extract_attributes,
|
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
get_element_html_by_class,
|
get_element_html_by_class,
|
||||||
get_element_html_by_id,
|
get_element_html_by_id,
|
||||||
@ -815,7 +814,7 @@ class VKMusicBaseIE(VKBaseIE):
|
|||||||
# ['Main Artist', 'Feat. Artist']
|
# ['Main Artist', 'Feat. Artist']
|
||||||
'artists': traverse_obj(
|
'artists': traverse_obj(
|
||||||
(*meta[17], *meta[18]) if len_ >= 18 else None,
|
(*meta[17], *meta[18]) if len_ >= 18 else None,
|
||||||
(..., 'name')) or [artist],
|
(..., 'name'), default=[artist]),
|
||||||
|
|
||||||
'duration': int_or_none(meta[5]) if len_ >= 5 else None,
|
'duration': int_or_none(meta[5]) if len_ >= 5 else None,
|
||||||
'thumbnails': [{'url': thumbnail}] if thumbnail else [],
|
'thumbnails': [{'url': thumbnail}] if thumbnail else [],
|
||||||
@ -1084,7 +1083,6 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
playlist_id)
|
playlist_id)
|
||||||
del hash_in_url
|
del hash_in_url
|
||||||
|
|
||||||
# to remove big scripts and other elements not used by parser
|
|
||||||
html = get_element_html_by_class('AudioPlaylistSnippet', webpage)
|
html = get_element_html_by_class('AudioPlaylistSnippet', webpage)
|
||||||
del webpage
|
del webpage
|
||||||
|
|
||||||
@ -1107,29 +1105,29 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
entries.append(self.url_result(
|
entries.append(self.url_result(
|
||||||
audio_url, VKMusicTrackIE, track_id, title, **info))
|
audio_url, VKMusicTrackIE, track_id, title, **info))
|
||||||
|
|
||||||
header = get_element_html_by_class('AudioPlaylistSnippet__header', html)
|
title = self._html_search_regex(
|
||||||
|
r'class="[^"]*AudioPlaylistSnippet__title--main[^"]*"[^>]*>([^<]+)',
|
||||||
|
html, 'playlist title', fatal=False, group=1)
|
||||||
|
|
||||||
title = clean_html(get_element_by_class('AudioPlaylistSnippet__title', header))
|
artist = self._html_search_regex(
|
||||||
artist = clean_html(get_element_by_class('AudioPlaylistSnippet__author', header))
|
r'class="[^"]*AudioPlaylistSnippet__author[^"]*"[^>]*>\s*<a(?:\s[^>]*)?>([^<]+)',
|
||||||
|
html, 'playlist author', fatal=False, group=1)
|
||||||
|
|
||||||
info_text = clean_html(get_element_by_class('AudioPlaylistSnippet__info', header))
|
description = clean_html(get_element_by_class(
|
||||||
info_sep = info_text.find('·')
|
'AudioPlaylistSnippet__description', html))
|
||||||
|
# description = self._html_search_regex(
|
||||||
|
# r'div\s[^>]*class="[^"]*AudioPlaylistSnippet__description[^"]*">??????',
|
||||||
|
# html, 'playlist description', fatal=False, group=1)
|
||||||
|
|
||||||
|
genre, year = self._html_search_regex(
|
||||||
|
r'class="[^"]*AudioPlaylistSnippet__info[^"]*"[^>]*>\s*(.+) .*;(\d+)\s*</',
|
||||||
|
html, 'genre and release year', default=(None, None), group=(1, 2))
|
||||||
|
|
||||||
year = int_or_none(info_text[info_sep + 1:]) if info_sep != -1 else None
|
|
||||||
is_album = year is not None
|
is_album = year is not None
|
||||||
genre = info_text[:info_sep].rstrip() if is_album else None
|
|
||||||
|
|
||||||
del header
|
thumbnail = url_or_none(self._html_search_regex(
|
||||||
|
r'class="[^"]*AudioPlaylistSnippet__cover[^"]*"[^>]*style="background-image\s*:\s*url\s*\(\s*\'([^\']+)',
|
||||||
description = clean_html(get_element_by_class('AudioPlaylistSnippet__description', html))
|
html, 'playlist thumbnail', fatal=False, group=1))
|
||||||
|
|
||||||
thumbnail = url_or_none(self._search_regex(
|
|
||||||
r'background[^:;]*:\s*url\s*\(\s*\'([^\']+)',
|
|
||||||
extract_attributes(
|
|
||||||
get_element_html_by_class(
|
|
||||||
'AudioPlaylistSnippet__cover',
|
|
||||||
html)).get('style'),
|
|
||||||
'playlist thumbnail', fatal=False, group=1))
|
|
||||||
|
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
entries, playlist_id,
|
entries, playlist_id,
|
||||||
@ -1140,7 +1138,7 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
artists=[artist] if is_album else None,
|
artists=[artist] if is_album else None,
|
||||||
thumbnails=[{'url': thumbnail}] if thumbnail else [],
|
thumbnails=[{'url': thumbnail}] if thumbnail else [],
|
||||||
genres=[genre] if genre else None,
|
genres=[genre] if genre else None,
|
||||||
release_year=year)
|
release_year=int_or_none(year))
|
||||||
|
|
||||||
|
|
||||||
class VKPlayBaseIE(InfoExtractor):
|
class VKPlayBaseIE(InfoExtractor):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user