From 931a87cec74b204839515ef76b08930093fe8fea Mon Sep 17 00:00:00 2001 From: Chris Coughlan Date: Sat, 11 Apr 2020 20:47:56 +0100 Subject: [PATCH 1/2] [FiteTV] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/fitetv.py | 51 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 youtube_dl/extractor/fitetv.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index e407ab3d9..b864059de 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -348,6 +348,7 @@ from .filmon import ( ) from .filmweb import FilmwebIE from .firsttv import FirstTVIE +from .fitetv import FiteTVIE from .fivemin import FiveMinIE from .fivetv import FiveTVIE from .flickr import FlickrIE diff --git a/youtube_dl/extractor/fitetv.py b/youtube_dl/extractor/fitetv.py new file mode 100644 index 000000000..2a7690852 --- /dev/null +++ b/youtube_dl/extractor/fitetv.py @@ -0,0 +1,51 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class FiteTVIE(InfoExtractor): + _VALID_URL = r"https?://(?:www\.)?fite\.tv/watch/(?:.+)/(?P.+)/" + _TESTS = [ + { + "url": "https://www.fite.tv/watch/all-out-press-conference-weigh-ins/2ozok/", + "md5": "60986200ae3ed52bfb990611583e0d03", + "info_dict": { + "id": "2ozok", + "ext": "mp4", + "title": "ALL OUT Press Conference & Weigh In", + "description": "Official Free Replay: ✓ All Elite Wrestling ✓ Pro Wrestling, Events, Press Conferences ✓ LIVE Aug 29, 8PM ET/5PM PT ✓ Jenn Decker ✓ Hyatt Regency Schaumburg ✓ 1800 E Golf Rd, Schaumburg, IL 60173, USA ✓ You must watch ALL OUT Press Conference & Weigh Ins hosted by Jenn Decker!", + "thumbnail": r"re:^https?://.*\.jpg$", + }, + } + ] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + json_ld = self._parse_json( + self._search_regex( + r'(?s)]+type=(["\'])application/ld\+json\1[^>]*>(?P[^<]+VideoObject[^<]+)', + webpage, + "json_ld", + group="json_ld", + ), + video_id, + ) + + info_dict = self._json_ld(json_ld, video_id) + + formats = self._extract_m3u8_formats( + "https://www.fite.tv/embed/play/%s.m3u8?" % video_id, video_id, "mp4" + ) + + self._sort_formats(formats) + + return { + "id": video_id, + "title": info_dict["title"], + "description": info_dict["description"], + "thumbnail": info_dict["thumbnail"], + "formats": formats, + } From 6d829b7456b14716389cc9bcfe3e9f83e9591947 Mon Sep 17 00:00:00 2001 From: Chris Coughlan Date: Sat, 11 Apr 2020 21:21:04 +0100 Subject: [PATCH 2/2] [FiteTV] Add fallbacks to metafield extraction --- youtube_dl/extractor/fitetv.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/fitetv.py b/youtube_dl/extractor/fitetv.py index 2a7690852..579b509e8 100644 --- a/youtube_dl/extractor/fitetv.py +++ b/youtube_dl/extractor/fitetv.py @@ -42,10 +42,14 @@ class FiteTVIE(InfoExtractor): self._sort_formats(formats) + title = info_dict.get("title") or self._og_search_title(webpage) + description = info_dict.get("description") or self._og_search_description(webpage) + thumbnail = info_dict.get("thumbnail") or self._og_search_thumbnail(webpage) + return { "id": video_id, - "title": info_dict["title"], - "description": info_dict["description"], - "thumbnail": info_dict["thumbnail"], + "title": title, + "description": description, + "thumbnail": thumbnail, "formats": formats, }