aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarenga <107524538+the-marenga@users.noreply.github.com>2022-10-09 03:50:44 +0200
committerGitHub <noreply@github.com>2022-10-09 07:20:44 +0530
commit5d14b734918c2c1230cd103d013d54ff194617f7 (patch)
tree9796645ebb9dee9297c645327d64c4ff2d2646dd
parent540236ce11a133675a3a9ea9b373155274fab550 (diff)
downloadhypervideo-pre-5d14b734918c2c1230cd103d013d54ff194617f7.tar.lz
hypervideo-pre-5d14b734918c2c1230cd103d013d54ff194617f7.tar.xz
hypervideo-pre-5d14b734918c2c1230cd103d013d54ff194617f7.zip
[VK] Fix playlist URLs (#4930)
Closes #2825 Authored by: the-marenga
-rw-r--r--yt_dlp/extractor/vk.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/yt_dlp/extractor/vk.py b/yt_dlp/extractor/vk.py
index 69f518b69..0c856e2b0 100644
--- a/yt_dlp/extractor/vk.py
+++ b/yt_dlp/extractor/vk.py
@@ -536,7 +536,7 @@ class VKIE(VKBaseIE):
class VKUserVideosIE(VKBaseIE):
IE_NAME = 'vk:uservideos'
IE_DESC = "VK - User's Videos"
- _VALID_URL = r'https?://(?:(?:m|new)\.)?vk\.com/video/@(?P<id>[^?$#/&]+)(?!\?.*\bz=video)(?:[/?#&](?:.*?\bsection=(?P<section>\w+))?|$)'
+ _VALID_URL = r'https?://(?:(?:m|new)\.)?vk\.com/video/(?:playlist/)?(?P<id>[^?$#/&]+)(?!\?.*\bz=video)(?:[/?#&](?:.*?\bsection=(?P<section>\w+))?|$)'
_TEMPLATE_URL = 'https://vk.com/videos'
_TESTS = [{
'url': 'https://vk.com/video/@mobidevices',
@@ -550,6 +550,13 @@ class VKUserVideosIE(VKBaseIE):
'id': '-17892518_uploaded',
},
'playlist_mincount': 182,
+ }, {
+ 'url': 'https://vk.com/video/playlist/-174476437_2',
+ 'info_dict': {
+ 'id': '-174476437_2',
+ 'title': 'Анонсы'
+ },
+ 'playlist_mincount': 108,
}]
_VIDEO = collections.namedtuple('Video', ['owner_id', 'id'])
@@ -584,11 +591,19 @@ class VKUserVideosIE(VKBaseIE):
def _real_extract(self, url):
u_id, section = self._match_valid_url(url).groups()
webpage = self._download_webpage(url, u_id)
- page_id = self._search_regex(r'data-owner-id\s?=\s?"([^"]+)"', webpage, 'page_id')
+
+ if u_id.startswith('@'):
+ page_id = self._search_regex(r'data-owner-id\s?=\s?"([^"]+)"', webpage, 'page_id')
+ elif '_' in u_id:
+ page_id, section = u_id.split('_', 1)
+ else:
+ raise ExtractorError('Invalid URL', expected=True)
+
if not section:
section = 'all'
- return self.playlist_result(self._entries(page_id, section), '%s_%s' % (page_id, section))
+ playlist_title = clean_html(get_element_by_class('VideoInfoPanel__title', webpage))
+ return self.playlist_result(self._entries(page_id, section), '%s_%s' % (page_id, section), playlist_title)
class VKWallPostIE(VKBaseIE):