Repository: yt-dlp/yt-dlp

Issue:
Wistia download throws error
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.09.01** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#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)
- [ ] 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

_No response_

### Provide a description that is worded well enough to be understood

Some Wistia videos cannot be downloaded and yt-dlp keeps on throwing an error. 

The link below is an example. It seems the extractor is not fetching the video's URL. Instead, it detects the video URL as "wistia:emyjmwjf79".

https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3&amp%5Bwvideo%5D=pz0m0l0if3&wchannelid=emyjmwjf79&wmediaid=i8um783bdt

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 28, in <module>
    from CommandNotFound import CommandNotFound
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
    from CommandNotFound.db.db import SqliteDatabase
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
[debug] Command-line config: ['-vU', 'https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out UTF-8, error UTF-8, screen UTF-8
[debug] yt-dlp version 2022.09.01 [5d7c7d6] (zip)
[debug] Python 3.7.5 (CPython 64bit) - Linux-4.15.0-135-generic-x86_64-with-Ubuntu-18.04-bionic (glibc 2.26)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2021.05.30, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.2
[debug] Proxy map: {}
[debug] Loaded 1670 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.09.01, Current version: 2022.09.01
yt-dlp is up to date (2022.09.01)
[debug] [generic] Extracting URL: https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3
[generic] amplify-sessions?amp[wmediaid]=pz0m0l0if3: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] amplify-sessions?amp[wmediaid]=pz0m0l0if3: Extracting information
[debug] Looking for Brightcove embeds
[debug] Looking for embeds
[debug] Identified a Wistia embed
[debug] [Wistia] Extracting URL: wistia:emyjmwjf79
[Wistia] emyjmwjf79: Downloading JSON metadata
ERROR: [Wistia] emyjmwjf79: Error while getting the playlist
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 670, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/wistia.py", line 178, in _real_extract
    embed_config = self._download_embed_config('media', video_id, url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/wistia.py", line 27, in _download_embed_config
    'Error while getting the playlist', expected=True)
```



Discussion:
Put the url in quotation marks (`yt-dlp "URL"`)
> ```shell
> https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3
> ```

Thanks, I tried that and it shows the same error:

```
[debug] Command-line config: ['https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3', '--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out UTF-8, error UTF-8, screen UTF-8
[debug] yt-dlp version 2022.09.01 [5d7c7d6] (zip)
[debug] Python 3.7.5 (CPython 64bit) - Linux-4.15.0-135-generic-x86_64-with-Ubuntu-18.04-bionic (glibc 2.26)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2021.05.30, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.2
[debug] Proxy map: {}
[debug] Loaded 1670 extractors
[debug] [generic] Extracting URL: https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3
[generic] amplify-sessions?amp[wmediaid]=pz0m0l0if3: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] amplify-sessions?amp[wmediaid]=pz0m0l0if3: Extracting information
[debug] Looking for Brightcove embeds
[debug] Looking for embeds
[debug] Identified a Wistia embed
[debug] [Wistia] Extracting URL: wistia:emyjmwjf79
[Wistia] emyjmwjf79: Downloading JSON metadata
ERROR: [Wistia] emyjmwjf79: Error while getting the playlist
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 670, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/wistia.py", line 178, in _real_extract
    embed_config = self._download_embed_config('media', video_id, url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/wistia.py", line 27, in _download_embed_config
    'Error while getting the playlist', expected=True)
```

Resolving patch:
diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py
--- a/yt_dlp/extractor/generic.py
+++ b/yt_dlp/extractor/generic.py
@@ -876,17 +876,19 @@ class GenericIE(InfoExtractor):
         # Wistia embed
         {
             'url': 'http://study.com/academy/lesson/north-american-exploration-failed-colonies-of-spain-france-england.html#lesson',
-            'md5': '1953f3a698ab51cfc948ed3992a0b7ff',
+            'md5': 'b9676d24bf30945d97060638fbfe77f0',
             'info_dict': {
-                'id': '6e2wtrbdaf',
-                'ext': 'mov',
-                'title': 'paywall_north-american-exploration-failed-colonies-of-spain-france-england',
-                'description': 'a Paywall Videos video from Remilon',
-                'duration': 644.072,
+                'id': '5vd7p4bct5',
+                'ext': 'bin',
+                'title': 'md5:db27290a04ae306319b0b5cce3cdf7bd',
+                'description': 'md5:e835b7808e11aaef29ccdc28888437af',
+                'duration': 623.019,
                 'uploader': 'study.com',
-                'timestamp': 1459678540,
-                'upload_date': '20160403',
-                'filesize': 24687186,
+                'timestamp': 1663258727,
+                'upload_date': '20220915',
+                'filesize': 29798093,
+                'age_limit': 0,
+                'thumbnail': r're:^https?://.+\.jpg$',
             },
         },
         # Wistia standard embed (async)
@@ -903,7 +905,20 @@ class GenericIE(InfoExtractor):
             },
             'params': {
                 'skip_download': True,
-            }
+            },
+            'skip': 'webpage 404 not found',
+        },
+        # Wistia embed with video IDs in query
+        {
+            'url': 'https://amplitude.com/amplify-sessions?amp%5Bwmediaid%5D=pz0m0l0if3&amp%5Bwvideo%5D=pz0m0l0if3&wchannelid=emyjmwjf79&wmediaid=i8um783bdt',
+            'info_dict': {
+                'id': 'md5:922795280019b3a70ca133330a4b0108',
+                'title': 'Amplify Sessions - Amplitude',
+                'description': 'md5:3d271bdee219417bb1c35eeb0937b923',
+                'age_limit': 0,
+                'thumbnail': r're:^https?://.+\.jpg$',
+            },
+            'playlist_count': 3,
         },
         # Soundcloud embed
         {
diff --git a/yt_dlp/extractor/wistia.py b/yt_dlp/extractor/wistia.py
--- a/yt_dlp/extractor/wistia.py
+++ b/yt_dlp/extractor/wistia.py
@@ -131,6 +131,20 @@ class WistiaIE(WistiaBaseIE):
             'timestamp': 1463607249,
             'duration': 4987.11,
         },
+        'skip': 'webpage 404 not found',
+    }, {
+        'url': 'wistia:5vd7p4bct5',
+        'md5': 'b9676d24bf30945d97060638fbfe77f0',
+        'info_dict': {
+            'id': '5vd7p4bct5',
+            'ext': 'bin',
+            'title': 'md5:eaa9f64c4efd7b5f098b9b6118597679',
+            'description': 'md5:a9bea0315f0616aa5df2dc413ddcdd0f',
+            'upload_date': '20220915',
+            'timestamp': 1663258727,
+            'duration': 623.019,
+            'thumbnail': r're:https?://embed(?:-ssl)?.wistia.com/.+\.(?:jpg|bin)$',
+        },
     }, {
         'url': 'wistia:sh7fpupwlt',
         'only_matching': True,
@@ -157,6 +171,8 @@ def _extract_embed_urls(cls, url, webpage):
             urls.append('wistia:%s' % match.group('id'))
         for match in re.finditer(r'(?:data-wistia-?id=["\']|Wistia\.embed\(["\']|id=["\']wistia_)(?P<id>[a-z0-9]{10})', webpage):
             urls.append('wistia:%s' % match.group('id'))
+        for match in re.finditer(r'(?:wmediaid|wvideo(?:id)?)(?:%5D)?=(?P<id>[a-z0-9]{10})', url):
+            urls.append('wistia:%s' % match.group('id'))
         return urls
 
     @classmethod


Test patch: