mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-02-18 10:07:55 +01:00
Remove extra metadata parsing
Since my goal in modifying this extractor was just to be able to get videos from another set of urls on the site and the code that I had added was doing more than that, I've pared it down to the bare essentials.
This commit is contained in:
parent
71b7f6133b
commit
43fff33749
@ -3,8 +3,6 @@ from __future__ import unicode_literals
|
||||
from .common import InfoExtractor
|
||||
from .ooyala import OoyalaIE
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
class TastyTradeIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?tastytrade\.com/tt/(?:shows|daily_recaps)/[^/]+/episodes/(?P<id>[^/?#&]+)'
|
||||
@ -32,8 +30,8 @@ class TastyTradeIE(InfoExtractor):
|
||||
'info_dict': {
|
||||
'id': 'lud3BtZTE6vnRdolxKRlwNoZQvb3z_LT',
|
||||
'ext': 'mp4',
|
||||
'title': 'Soybeans & Corn: It\'s Planting Time',
|
||||
'description': 'md5:a523504b1227de1b81faeba2876a6d23',
|
||||
'title': 'TTL_CTGFE_180309_SEG_EDIT.mp4',
|
||||
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
|
||||
},
|
||||
'params': {
|
||||
'skip_download': True,
|
||||
@ -49,35 +47,7 @@ class TastyTradeIE(InfoExtractor):
|
||||
r'data-media-id=(["\'])(?P<code>(?:(?!\1).)+)\1',
|
||||
webpage, 'ooyala code', group='code')
|
||||
|
||||
info = {'id': None, 'title': None, 'description': None}
|
||||
|
||||
json_ld_info = self._search_json_ld(
|
||||
webpage, display_id, default=None, fatal=False)
|
||||
|
||||
if (json_ld_info):
|
||||
info = json_ld_info
|
||||
else:
|
||||
escaped_json_string = self._search_regex(
|
||||
r'var episodeData = \$.parseJSON\("(?P<episode_json>.*)"\)',
|
||||
webpage,
|
||||
'episode json',
|
||||
fatal=False,
|
||||
group='episode_json'
|
||||
)
|
||||
|
||||
if (escaped_json_string):
|
||||
if sys.version_info[0] >= 3:
|
||||
unescaped_json_string = bytes(
|
||||
escaped_json_string, "utf-8").decode('unicode_escape')
|
||||
else:
|
||||
unescaped_json_string = escaped_json_string.decode(
|
||||
'string_escape')
|
||||
metadata = self._parse_json(unescaped_json_string, ooyala_code)
|
||||
info = {
|
||||
'id': metadata.get('mediaId'),
|
||||
'title': metadata.get('title'),
|
||||
'description': metadata.get('description')
|
||||
}
|
||||
info = self._search_json_ld(webpage, display_id, default={})
|
||||
|
||||
info.update({
|
||||
'_type': 'url_transparent',
|
||||
|
Loading…
Reference in New Issue
Block a user