From 43fff33749397d82cea18090434d7d7d62029478 Mon Sep 17 00:00:00 2001 From: Kai Curtis Date: Mon, 12 Mar 2018 10:23:33 -0700 Subject: [PATCH] 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. --- youtube_dl/extractor/tastytrade.py | 36 +++--------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/youtube_dl/extractor/tastytrade.py b/youtube_dl/extractor/tastytrade.py index 31acdaed8..d5b0bff4b 100644 --- a/youtube_dl/extractor/tastytrade.py +++ b/youtube_dl/extractor/tastytrade.py @@ -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[^/?#&]+)' @@ -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(?:(?!\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.*)"\)', - 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',