[cleanup] Misc (#8968)
[yt-dlp.git] / yt_dlp / extractor / ebay.py
blobd0eb9fc51cc136cfd3ad96cded1318fa058dc4f7
1 from .common import InfoExtractor
2 from ..utils import remove_end
5 class EbayIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?ebay\.com/itm/(?P<id>\d+)'
7 _TESTS = [{
8 'url': 'https://www.ebay.com/itm/194509326719',
9 'info_dict': {
10 'id': '194509326719',
11 'ext': 'mp4',
12 'title': 'WiFi internal antenna adhesive for wifi 2.4GHz wifi 5 wifi 6 wifi 6E full bands',
14 'params': {'skip_download': 'm3u8'}
17 def _real_extract(self, url):
18 video_id = self._match_id(url)
19 webpage = self._download_webpage(url, video_id)
21 video_json = self._search_json(r'"video":', webpage, 'video json', video_id)
23 formats = []
24 for key, url in video_json['playlistMap'].items():
25 if key == 'HLS':
26 formats.extend(self._extract_m3u8_formats(url, video_id, fatal=False))
27 elif key == 'DASH':
28 formats.extend(self._extract_mpd_formats(url, video_id, fatal=False))
29 else:
30 self.report_warning(f'Unsupported format {key}', video_id)
32 return {
33 'id': video_id,
34 'title': remove_end(self._html_extract_title(webpage), ' | eBay'),
35 'formats': formats