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
[Stitcher] - Reorganized call to json data accessing of {config} and … #20811
[Stitcher] - Reorganized call to json data accessing of {config} and … #20811
Conversation
…{feed} to support return of show_title and publication_date in response to ticket #20510
# Safe grab 'config' json data using get() | ||
config = self._parse_json( | ||
js_to_json(self._search_regex(r'(?s)var\s+stitcher(?:Config)?\s*=\s*({.+?});\n', webpage, 'episode config')), | ||
display_id).get('config') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this does not make any sense.
display_id).get('config') | ||
|
||
# Safe grab 'episode' json data using get() | ||
episode = config.get('episode') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
episode = config.get('episode') | ||
|
||
# Safe grab 'episode' json data using get() | ||
feed = config.get('feed') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this does not give your any safety.
@@ -69,12 +88,16 @@ def _real_extract(self, url): | |||
r'Episode Info:\s*</span>([^<]+)<', webpage, 'description', fatal=False) | |||
duration = int_or_none(episode.get('duration')) | |||
thumbnail = episode.get('episodeImage') | |||
pub_date = episode.get('pubDate') | |||
show_name = feed.get('name') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaks.
…{feed} to support return of show_title and publication_date in response to ticket #20510
Please follow the guide below
x
into all the boxes [ ] relevant to your pull request (like that [x])Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Description of your pull request and other information
Responding to @wertercatt's open ticket (Ticket #20510) for poor metadata extraction of Stitcher URLs, I added the support to display the show that uploaded the podcast episode as well as the release/publication date in the info_dict object. These two items are encoded as "show_name" and "publication_date".
A test case was added to test the new functionality of "show_name" and "publication_date".
Subsequently, I noticed that the contribution and coding practice guidelines recommending using the get() method to better support backwards compatibility so that the extractor code does not break. Therefore, I reformatted the previous calls to self._parse_json() to utilize the get() method to extract data from ['config']['episode'] and ['config']['feed'] for "show_name" and "publication_date" respectively.