[willow] Add extractor (#1723)

Authored by: aarubui
This commit is contained in:
aarubui 2021-11-20 15:03:43 +11:00 committed by GitHub
parent d76991ab07
commit 545ad64988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 0 deletions

View File

@ -1789,6 +1789,7 @@
WeiboMobileIE WeiboMobileIE
) )
from .weiqitv import WeiqiTVIE from .weiqitv import WeiqiTVIE
from .willow import WillowIE
from .wimtv import WimTVIE from .wimtv import WimTVIE
from .whowatch import WhoWatchIE from .whowatch import WhoWatchIE
from .wistia import ( from .wistia import (

View File

@ -0,0 +1,58 @@
# coding: utf-8
from ..utils import ExtractorError
from .common import InfoExtractor
class WillowIE(InfoExtractor):
_VALID_URL = r'https?://(www\.)?willow\.tv/videos/(?P<id>[0-9a-z-_]+)'
_GEO_COUNTRIES = ['US']
_TESTS = [{
'url': 'http://willow.tv/videos/d5winning-moment-eng-vs-ind-streaming-online-4th-test-india-tour-of-england-2021',
'info_dict': {
'id': '169662',
'display_id': 'd5winning-moment-eng-vs-ind-streaming-online-4th-test-india-tour-of-england-2021',
'ext': 'mp4',
'title': 'Winning Moment: 4th Test, England vs India',
'thumbnail': 'https://aimages.willow.tv/ytThumbnails/6748_D5winning_moment.jpg',
'duration': 233,
'timestamp': 1630947954,
'upload_date': '20210906',
'location': 'Kennington Oval, London',
'series': 'India tour of England 2021',
},
'params': {
'skip_download': True, # AES-encrypted m3u8
},
}, {
'url': 'http://willow.tv/videos/highlights-short-ind-vs-nz-streaming-online-2nd-t20i-new-zealand-tour-of-india-2021',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_data = self._parse_json(self._html_search_regex(
r'var\s+data_js\s*=\s*JSON\.parse\(\'(.+)\'\)', webpage,
'data_js'), video_id)
video = next((v for v in video_data.get('trending_videos') or []
if v.get('secureurl')), None)
if not video:
raise ExtractorError('No videos found')
formats = self._extract_m3u8_formats(video['secureurl'], video_id, 'mp4')
self._sort_formats(formats)
return {
'id': str(video.get('content_id')),
'display_id': video.get('video_slug'),
'title': video.get('video_name') or self._html_search_meta('twitter:title', webpage),
'formats': formats,
'thumbnail': video.get('yt_thumb_url') or self._html_search_meta(
'twitter:image', webpage, default=None),
'duration': video.get('duration_seconds'),
'timestamp': video.get('created_date'),
'location': video.get('venue'),
'series': video.get('series_name'),
}