Skip to content

Commit

Permalink
[YouTube] Avoid crash if uploader_id extraction fails
Browse files Browse the repository at this point in the history
See #31530.
  • Loading branch information
dirkf authored Feb 17, 2023
1 parent dd9aa74 commit 2dd6c6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion youtube_dl/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,9 @@ def gen_owner_profile_url():
microformat.get('uploadDate')
or search_meta('uploadDate')),
'uploader': video_details['author'],
'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,
'uploader_id': self._search_regex(
r'/(?:channel|user)/([^/?&#]+)', owner_profile_url,
'uploader id', fatal=False) if owner_profile_url else None,
'uploader_url': owner_profile_url,
'channel_id': channel_id,
'channel_url': 'https://www.youtube.com/channel/' + channel_id if channel_id else None,
Expand Down

11 comments on commit 2dd6c6e

@paulgortmaker
Copy link

Choose a reason for hiding this comment

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

Thanks for the quick fix!

@Ze18

This comment was marked as resolved.

@luweigen
Copy link

Choose a reason for hiding this comment

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

where is this file on my machine? and what editor do i use to edit it? i don't know what to do!

git clone https://github.com/ytdl-org/youtube-dl.git
cd youtube-dl
make youtube-dl
sudo mv /usr/local/bin/youtube-dl /usr/local/bin/youtube-dl.old
sudo mv youtube-dl /usr/local/bin/
chmod 755 /usr/local/bin/youtube-dl

@Havrushchyk
Copy link

Choose a reason for hiding this comment

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

Thanks for that fix!

@DmytroUsenko

This comment was marked as resolved.

@i-am-dan
Copy link

@i-am-dan i-am-dan commented on 2dd6c6e Feb 18, 2023

Choose a reason for hiding this comment

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

I saw this line of code yesterday and I was wondering why the source code wouldn't fail but the executable failed. Duh.. the release didn't have the Fatal flag set to 'false'. Thank you!

@ProvisionlabTeam I've cloned the source code and built the package myself using pip. Or you can call 'python main.py [Video URL] ' from the source code to download the video. lol..

@dirkf I did notice with some combination of the -f argument parameter the program still crash with 'uploader id' regex error. I can try to figure out the combination and update this comment if this error should always 'gracefully' halt

Thanks again!

@dirkf
Copy link
Contributor Author

@dirkf dirkf commented on 2dd6c6e Feb 18, 2023

Choose a reason for hiding this comment

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

do you plan to provide a new release with it patch?

Yes, but that has been true since 2022-01.

... with some combination of the -f argument parameter the program still crash with 'uploader id'

Could only happen if owner_profile_url was truthy but not a string. The code that sets owner_profile_url shouldn't be able to do that, and it wouldn't depend on format selection anyway. Maybe some other error that looks similar? See #31577 (comment).

@i-am-dan
Copy link

Choose a reason for hiding this comment

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

@dirkf I'll check. I've definitely seen the regex error with different combination of parameters for -f. Or maybe it was for extracting audio. I've lost history of my commands so I'd have to brute force it. Lol. Thanks for the quick fixes and the replies. Appreciate it!

@Guimhoff

This comment was marked as resolved.

@dirkf
Copy link
Contributor Author

@dirkf dirkf commented on 2dd6c6e Feb 19, 2023

Choose a reason for hiding this comment

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

How to compile my own youtube-dl.exe ?

Just get a nightly build. See #31530. Also, @1paulofernandes.

@1paulofernandes

This comment was marked as resolved.

Please sign in to comment.