Skip to content
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

Fixes a crash when release_year as well as release_date are None and … #28094

Closed
wants to merge 1 commit into from

Conversation

redneptun
Copy link

…therefore no year can be retrieved. Before the fix it resulted in failing to cast None to int. I noticed the crash when trying to download an m4a using the parameters -f 140 --skip-unavailable-fragments https://youtu.be/OtqTfy26tG0

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

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:

  • [ x] I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • [ x] Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Explanation of your pull request in arbitrary form goes here. Please make sure the description explains the purpose and effect of your pull request and is worded well enough to be understood. Provide as much context and examples as possible.

…therefore no year can be retrieved. Before the fix it resulted in failing to cast None to int. I noticed the crash when trying to download an m4a using the parameters -f 140 --skip-unavailable-fragments https://www.youtube.com/watch?v=OtqTfy26tG0&list=PLwpO1O2Nt4_JUxnCuyP9Uz3uDX3fELp3Z&index=36
@dstftw
Copy link
Collaborator

dstftw commented Feb 6, 2021

  • Covered the code with tests (note that PRs without tests will be REJECTED)

@@ -1735,7 +1735,7 @@ def process_language(container, base_url, lang_code, query):
'artist': mobj.group('clean_artist') or ', '.join(a.strip() for a in mobj.group('artist').split('·')),
'track': mobj.group('track').strip(),
'release_date': release_date,
'release_year': int(release_year),
'release_year': int(release_year) if release_year else 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Lack of data is denoted by None, not 0.
  2. int_or_none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants