-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
[Instagram] Extract video dimensions #10790
Conversation
formats = [{ | ||
'url': self._og_search_video_url(webpage, secure=False), | ||
'height': int_or_none(media.get('dimensions', {}).get('height')), | ||
'width': int_or_none(media.get('dimensions', {}).get('width')), |
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.
Code duplication.
formats = [{ | ||
'url': media.get('video_url'), | ||
'height': int_or_none(media.get('dimensions', {}).get('height')), | ||
'width': int_or_none(media.get('dimensions', {}).get('width')), |
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.
Code duplication.
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.
fixed
ab85482
to
2c18e1a
Compare
'url': self._og_search_video_url(webpage, secure=False), | ||
'height': height, | ||
'width': width, | ||
}] |
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.
Nothing really changed. You construct the same structure two times.
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.
does it look better now?
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.
Why not just
video_url = ...
width = ...
height = ...
...
if not video_url:
video_url = ...
...
formats = [{
'url': video_url,
'width': width,
'height': height,
}]
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.
That does seem better. Thanks, applied
df13bf3
to
4f57e36
Compare
formats = [{ | ||
'url': video_url, | ||
'width': width, | ||
'height': height, |
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.
Dimensions are uninitialized when media
is not available.
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.
fixed
4f57e36
to
695e18b
Compare
Cherry-picked in 1609782, thanks. |
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
Extracts dimensions from Instagram videos.