summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/ebay.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:37:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:37:42 +0000
commitc7bab7c39fd51c0812f70020172766303191bc01 (patch)
tree56c05fbdd4fc47409d48ba318a4b621a7b0d299a /yt_dlp/extractor/ebay.py
parentInitial commit. (diff)
downloadyt-dlp-c7bab7c39fd51c0812f70020172766303191bc01.tar.xz
yt-dlp-c7bab7c39fd51c0812f70020172766303191bc01.zip
Adding upstream version 2023.03.04.upstream/2023.03.04upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/ebay.py')
-rw-r--r--yt_dlp/extractor/ebay.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/yt_dlp/extractor/ebay.py b/yt_dlp/extractor/ebay.py
new file mode 100644
index 0000000..d0eb9fc
--- /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
+ }