Repository: yt-dlp/yt-dlp

Issue:
VK.com Playlists can't be downloaded anymore
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.02.04**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Germany

### Description

A few months ago vk.com changed their url schema. For a while you were able to convert the new url into the old url, but that is not possible anymore.

example new url: https://vk.com/video/playlist/-28532279_55889438
example old url: https://vk.com/videos-28532279?section=album_55889438

I've found a similar [issue](https://github.com/yt-dlp/yt-dlp/issues/2196) but that only concerns channels (even though it mentions playlists in the title).

### Verbose log

```shell
[debug] Command-line config: ['-vU', '-i', 'https://vk.com/video/playlist/-28532279_55889438']
[debug] Home config "yt-dlp.conf": ['-o', '~/Movies/PRIVATE/VR/%(title)s/%(title)s-%(id)s.%(ext)s', '--download-archive', '~/.config/youtube-dl/downloaded.txt']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8 (No ANSI), err utf-8, pref UTF-8
[debug] yt-dlp version 2022.02.04 [c1653e9ef]
[debug] Python version 3.9.10 (CPython 64bit) - macOS-11.4-x86_64-i386-64bit
[debug] exe versions: ffmpeg 5.0 (setts), ffprobe 5.0
[debug] Optional libraries: sqlite
[debug] Proxy map: {}
[debug] Loading archive file '/Users/PRIVATE/.config/youtube-dl/downloaded.txt'
[debug] [generic] Extracting URL: https://vk.com/video/playlist/-28532279_55889438
WARNING: [generic] Could not send HEAD request to https://vk.com/video/playlist/-28532279_55889438: HTTP Error 418: 
WARNING: [generic] Falling back on generic information extractor.
[debug] Looking for video embeds
[debug] [generic] Extracting URL: https://vk.com/badbrowser.php
WARNING: [generic] Could not send HEAD request to https://vk.com/badbrowser.php: HTTP Error 418: 
WARNING: [generic] Falling back on generic information extractor.
[debug] Looking for video embeds
ERROR: Unsupported URL: https://vk.com/badbrowser.php
Traceback (most recent call last):
  File "/usr/local/Cellar/yt-dlp/2022.2.4/libexec/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1381, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/Cellar/yt-dlp/2022.2.4/libexec/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1451, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/local/Cellar/yt-dlp/2022.2.4/libexec/lib/python3.9/site-packages/yt_dlp/extractor/common.py", line 612, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/Cellar/yt-dlp/2022.2.4/libexec/lib/python3.9/site-packages/yt_dlp/extractor/generic.py", line 3986, in _real_extract
    raise UnsupportedError(url)
yt_dlp.utils.UnsupportedError: Unsupported URL: https://vk.com/badbrowser.php
```



Discussion:
There is no extractor defined for the so-called "old" URL. Are you sure that used to work?
Before vk changed their url schema it did. Since then I was able to adjust it for a while. Haven't tried it the last few (probably 6?) months and now it's not working anymore.
Can you please fix this? I can't download Vk playlist anymore ether! Please don't ignor this!

Resolving patch:
diff --git a/yt_dlp/extractor/vk.py b/yt_dlp/extractor/vk.py
--- a/yt_dlp/extractor/vk.py
+++ b/yt_dlp/extractor/vk.py
@@ -536,7 +536,7 @@ def _real_extract(self, url):
 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 @@ def _entries(self, page_id, section):
     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):


Test patch: