Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FiteTV] Add new extractor #24738

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
)
from .filmweb import FilmwebIE
from .firsttv import FirstTVIE
from .fitetv import FiteTVIE
from .fivemin import FiveMinIE
from .fivetv import FiveTVIE
from .flickr import FlickrIE
Expand Down
55 changes: 55 additions & 0 deletions youtube_dl/extractor/fitetv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# coding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor


class FiteTVIE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?fite\.tv/watch/(?:.+)/(?P<id>.+)/"
_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)<script[^>]+type=(["\'])application/ld\+json\1[^>]*>(?P<json_ld>[^<]+VideoObject[^<]+)</script>',
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)

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": title,
"description": description,
"thumbnail": thumbnail,
"formats": formats,
}