1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-13 22:27:23 +08:00

[nytimes] Remove untestable fallback for JS parsing failure

Per @yan12125, who I guess is concerned about testability.
Fair enough, though fragility seems an issue too.

I could imagine using smuggle_url() to pass in a directive to bypass
JS parsing, but that seems way too ugly. Does that imply something
about the testing framework?

Partial revert of 2117b36d09bfc55cb633f4cf8acad92184e8d475
This commit is contained in:
John Hawkinson 2016-10-15 05:23:47 -04:00
parent 5375b7ff9c
commit ccb27a857c

View File

@ -212,14 +212,5 @@ class NYTimesArticleIE(NYTimesBaseIE):
data_json = self._html_search_regex(r'NYTD.FlexTypes.push\(({[^)]*)\)', webpage, 'json data', None, False);
if data_json is not None:
return self._extract_podcast_from_json(data_json, page_id, webpage)
# Fallback case
# "source":"https:\/\/rss.art19.com\/episodes\/0e2bd0b3-10ef-42c4-9494-0e3d21d2b82a.mp3","
url=self._html_search_regex(r'"source":"(https?:[^"]+)"', webpage, 'mp3 url')
url = url.replace('\\/','/')
if url is not None:
return {
'id': page_id,
'title': self._og_search_title(webpage),
'url': url
}
else:
raise UnsupportedError(url)