mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 06:14:05 -07:00
Added ChelseaFc Extractor
Added support for ChelseaFc.com
This commit is contained in:
parent
00ef748cc0
commit
73b2e02266
2 changed files with 89 additions and 0 deletions
81
youtube_dl/extractor/chelseafc.py
Normal file
81
youtube_dl/extractor/chelseafc.py
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
traverse_obj,
|
||||||
|
unified_timestamp,
|
||||||
|
url_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ChelseafcIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?chelseafc\.com(?:/[a-z]+)?/video/(?P<id>[a-z0-9]+(?:-[a-z0-9]+)*)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.chelseafc.com/en/video/training-ahead-of-brentford-27-10-2023',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'training-ahead-of-brentford-27-10-2023',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Training ahead of Brentford ⚽️',
|
||||||
|
'description': 'Watch another set of intense training sessions ahead of our London derby against Brentford this Saturday...',
|
||||||
|
'duration': 481.0,
|
||||||
|
'timestamp': 1698411300,
|
||||||
|
'tags': ['Brentford', 'Kit Launch'],
|
||||||
|
'upload_date': '20231027',
|
||||||
|
'thumbnail': r're:https?://.*.jpg'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://www.chelseafc.com/en/video/pochettinos-press-conference-27-10-2023',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'pochettinos-press-conference-27-10-2023',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '🎙️ Pochettino\'s press conference',
|
||||||
|
'description': 'Every word of Mauricio\'s press conference, ahead of Saturday\'s Premier League match against Brentford at Stamford Bridge...',
|
||||||
|
'duration': 729.0,
|
||||||
|
'timestamp': 1698410700,
|
||||||
|
'tags': ['Press Conferences', 'Mauricio Pochettino', 'Brentford', 'Premier League'],
|
||||||
|
'upload_date': '20231027',
|
||||||
|
'thumbnail': r're:https?://.*.jpg'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_details_div = self._search_regex(
|
||||||
|
r'(<div\s[^>]*\bdata-component\s*=\s*(?:"|\')\s*VideoDetails\s*(?:"|\')[^>]*>)',
|
||||||
|
webpage,
|
||||||
|
'div'
|
||||||
|
)
|
||||||
|
raw_data = self._html_search_regex(
|
||||||
|
r'<div[^>]*\sdata-props\s*=\s*(?:"|\')\s*([^"\']*)\s*(?:"|\')[^>]*>',
|
||||||
|
video_details_div,
|
||||||
|
'data'
|
||||||
|
)
|
||||||
|
|
||||||
|
data = self._parse_json(raw_data, video_id)
|
||||||
|
manifest_url = data['videoDetail']['signedUrl']
|
||||||
|
|
||||||
|
data = data['videoDetail']
|
||||||
|
|
||||||
|
title = data['title']
|
||||||
|
|
||||||
|
formats = self._extract_m3u8_formats(manifest_url, video_id, 'mp4')
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
txt_or_none = lambda x: x.strip() or None
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': txt_or_none(data.get('description')),
|
||||||
|
'formats': formats,
|
||||||
|
'duration': parse_duration(data.get('duration')),
|
||||||
|
'timestamp': unified_timestamp(data.get('releaseDate')),
|
||||||
|
'tags': traverse_obj(data, ('tags', Ellipsis, 'title'), expected_type=txt_or_none),
|
||||||
|
'thumbnail': traverse_obj(data, ('image', 'file', 'url'), expected_type=url_or_none),
|
||||||
|
}
|
|
@ -214,6 +214,7 @@ from .ceskatelevize import CeskaTelevizeIE
|
||||||
from .channel9 import Channel9IE
|
from .channel9 import Channel9IE
|
||||||
from .charlierose import CharlieRoseIE
|
from .charlierose import CharlieRoseIE
|
||||||
from .chaturbate import ChaturbateIE
|
from .chaturbate import ChaturbateIE
|
||||||
|
from .chelseafc import ChelseafcIE
|
||||||
from .chilloutzone import ChilloutzoneIE
|
from .chilloutzone import ChilloutzoneIE
|
||||||
from .chirbit import (
|
from .chirbit import (
|
||||||
ChirbitIE,
|
ChirbitIE,
|
||||||
|
@ -566,6 +567,7 @@ from .khanacademy import (
|
||||||
KhanAcademyIE,
|
KhanAcademyIE,
|
||||||
KhanAcademyUnitIE,
|
KhanAcademyUnitIE,
|
||||||
)
|
)
|
||||||
|
from .kick import KickIE
|
||||||
from .kickstarter import KickStarterIE
|
from .kickstarter import KickStarterIE
|
||||||
from .kinja import KinjaEmbedIE
|
from .kinja import KinjaEmbedIE
|
||||||
from .kinopoisk import KinoPoiskIE
|
from .kinopoisk import KinoPoiskIE
|
||||||
|
@ -995,6 +997,10 @@ from .puhutv import (
|
||||||
PuhuTVIE,
|
PuhuTVIE,
|
||||||
PuhuTVSerieIE,
|
PuhuTVSerieIE,
|
||||||
)
|
)
|
||||||
|
from .pr0gramm import (
|
||||||
|
Pr0grammIE,
|
||||||
|
Pr0grammStaticIE,
|
||||||
|
)
|
||||||
from .presstv import PressTVIE
|
from .presstv import PressTVIE
|
||||||
from .prosiebensat1 import ProSiebenSat1IE
|
from .prosiebensat1 import ProSiebenSat1IE
|
||||||
from .puls4 import Puls4IE
|
from .puls4 import Puls4IE
|
||||||
|
@ -1441,6 +1447,7 @@ from .uplynk import (
|
||||||
UplynkIE,
|
UplynkIE,
|
||||||
UplynkPreplayIE,
|
UplynkPreplayIE,
|
||||||
)
|
)
|
||||||
|
from .upride import UprideIE
|
||||||
from .urort import UrortIE
|
from .urort import UrortIE
|
||||||
from .urplay import URPlayIE
|
from .urplay import URPlayIE
|
||||||
from .usanetwork import USANetworkIE
|
from .usanetwork import USANetworkIE
|
||||||
|
@ -1548,6 +1555,7 @@ from .vrv import (
|
||||||
)
|
)
|
||||||
from .vshare import VShareIE
|
from .vshare import VShareIE
|
||||||
from .vtm import VTMIE
|
from .vtm import VTMIE
|
||||||
|
from .vtv import VTVIE
|
||||||
from .medialaan import MedialaanIE
|
from .medialaan import MedialaanIE
|
||||||
from .vube import VubeIE
|
from .vube import VubeIE
|
||||||
from .vuclip import VuClipIE
|
from .vuclip import VuClipIE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue