Repository: yt-dlp/yt-dlp

Issue:
Support for eBay listing videos
### 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 new site support request
- [X] I've verified that I'm running yt-dlp version **2023.01.06** ([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 none of provided URLs [violate any copyrights](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge
- [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 am willing to share it if required

### Region

_No response_

### Example URLs

https://www.ebay.com/itm/194509326719

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

eBay apparently have begun supporting videos in the listing gallery, mixed in with the photos. Someone sent me a URL (provided in the Example URLs) which contains one such video. It's the second item in the gallery (click the thumbnail with the play button on the left of the main image).

Tested with yt-dlp (latest) but appears there's no support yet. The browser network log shows M4S segmented video/audio streams being downloaded when played.

### 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
[debug] Command-line config: ['-vU', '-F', 'https://www.ebay.com/itm/194509326719']
[debug] Portable config "D:\Global\yt-dlp.conf": ['-o', 'M:\\Videos\\%(title)s [%(uploader)s, %(extractor)s].%(ext)s', '--console-
title', '--no-mtime', '--add-metadata', '--compat-options', 'all', '--no-clean-infojson', '--compat-option', 'filename-sanitizatio
n']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version 2023.01.06 [6becd25] (win_exe)
[debug] Compatibility options: no-external-downloader-progress, format-spec, list-formats, multistreams, no-live-chat, no-direct-m
erge, embed-metadata, embed-thumbnail-atomicparsley, *filename, no-youtube-channel-redirect, filename-sanitization, playlist-index
, no-certifi, no-playlist-metafiles, format-sort, *no-clean-infojson, abort-on-error, no-youtube-prefer-utc-upload-date, seperate-
video-versions, no-attach-info-json, no-keep-subs, no-youtube-unavailable-videos
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-8.1-6.3.9600-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-105349-g0a83ecbf48-20220124 (setts), ffprobe N-105349-g0a83ecbf48-20220124, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
[generic] Extracting URL: https://www.ebay.com/itm/194509326719
[generic] 194509326719: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 194509326719: Extracting information
[debug] Looking for embeds
ERROR: Unsupported URL: https://www.ebay.com/itm/194509326719
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1502, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1578, in __extract_info
  File "yt_dlp\extractor\common.py", line 680, in extract
  File "yt_dlp\extractor\generic.py", line 2523, in _real_extract
yt_dlp.utils.UnsupportedError: Unsupported URL: https://www.ebay.com/itm/194509326719
```



Discussion:
Since I'm not sure how long that listing will remain accessible (depending on the relisting settings after some number of weeks it might not be) and haven't come across such videos in listings often, I've attached the DASH and HLS playlists as pointed out by the above comment for reference.

Renamed to `-<format>.txt` since Github has a whitelist of attachable formats.

[playlist-dash.txt](https://github.com/yt-dlp/yt-dlp/files/10577235/playlist-dash.txt)
[playlist-hls.txt](https://github.com/yt-dlp/yt-dlp/files/10577236/playlist-hls.txt)
> until it will be added

Thanks. I found that just using `ffmpeg -i "<HLSplaylistURL>" -codec copy output.mp4` was sufficient to download the highest quality video and accompanying audio stream and have them auto muxed, for those curious.

Resolving patch:
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py
--- a/yt_dlp/extractor/_extractors.py
+++ b/yt_dlp/extractor/_extractors.py
@@ -506,6 +506,7 @@
 )
 from .eagleplatform import EaglePlatformIE, ClipYouEmbedIE
 from .ebaumsworld import EbaumsWorldIE
+from .ebay import EbayIE
 from .echomsk import EchoMskIE
 from .egghead import (
     EggheadCourseIE,
diff --git a/yt_dlp/extractor/ebay.py b/yt_dlp/extractor/ebay.py
new file mode 100644
--- /dev/null
+++ b/yt_dlp/extractor/ebay.py
@@ -0,0 +1,36 @@
+from .common import InfoExtractor
+from ..utils import remove_end
+
+
+class EbayIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
+    _TESTS = [{
+        'url': 'https://www.ebay.com/itm/194509326719',
+        'info_dict': {
+            'id': '194509326719',
+            'ext': 'mp4',
+            'title': 'WiFi internal antenna adhesive for wifi 2.4GHz wifi 5 wifi 6 wifi 6E full bands',
+        },
+        'params': {'skip_download': 'm3u8'}
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+
+        video_json = self._search_json(r'"video":', webpage, 'video json', video_id)
+
+        formats = []
+        for key, url in video_json['playlistMap'].items():
+            if key == 'HLS':
+                formats.extend(self._extract_m3u8_formats(url, video_id, fatal=False))
+            elif key == 'DASH':
+                formats.extend(self._extract_mpd_formats(url, video_id, fatal=False))
+            else:
+                self.report_warning(f'Unsupported format {key}', video_id)
+
+        return {
+            'id': video_id,
+            'title': remove_end(self._html_extract_title(webpage), ' | eBay'),
+            'formats': formats
+        }


Test patch: