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

Running Youtube-DL on Linux (Ubuntu) #31810

Closed
spaceman5 opened this issue Mar 10, 2023 · 30 comments
Closed

Running Youtube-DL on Linux (Ubuntu) #31810

spaceman5 opened this issue Mar 10, 2023 · 30 comments

Comments

@spaceman5
Copy link

spaceman5 commented Mar 10, 2023

Hi all

Since youtube-dl.exe is not updated,
I tried installing youtube-dl on a Linux machine that I have (Ubuntu), using:
apt install youtube-dl

The installation was successful,
however when running it, the uploader_id problem remains there too.
I thought it would be updated there.

So my question is: what should I do to get the most updated build there, that will work?

Maybe install Python, and then inside it install youtube-dl using pip?
Please suggest the simplest solution..

Thank you

@memberwebm

This comment was marked as duplicate.

@dirkf
Copy link
Contributor

dirkf commented Mar 10, 2023

#30839.

@dirkf dirkf closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 2023
@nicolaasjan
Copy link

Maybe install Python, and then inside it install youtube-dl using pip?

Ubuntu already has Python. 🙂

pip install git+https://github.com/ytdl-org/youtube-dl.git@master

@dirkf
Copy link
Contributor

dirkf commented Mar 10, 2023

Follow the link from the pinned issue (that you should have read already) which should have caused you to read the actual issue that covers this problem instead of opening a new issue for no good reason at all. In the master issue, you are advised how to update the program. In particular, you could add a PPA to your Ubuntu setup that has a new version of yt-dl. But since repo versions of yt-dl generally don't get updated often enough, even when yt-dl releases are made, the solutions using pip may be better.

@spaceman5
Copy link
Author

I did it, and it worked.
Thank you very much.

BTW,
what's the difference between:
pip install git+https://github.com/ytdl-org/youtube-dl.git@master#egg=youtube_dl
and
pip install git+https://github.com/ytdl-org/youtube-dl.git@master
?

What does the "#egg=youtube_dl" parameter do?
(I ran mine with the egg parameter)

@dirkf
Copy link
Contributor

dirkf commented Mar 10, 2023

Please find out and tell us (in the master thread). A guess is that a package installable with pip can have optional features and this syntax specifies the youtube_dl feature. Possibly there is no such feature and the parameter is silently ignored, or it might install a youtube-dl command, so that omitting it might not be important when updating a previous installation, or ...

@spaceman5

This comment was marked as outdated.

@nicolaasjan

This comment was marked as outdated.

@spaceman5

This comment was marked as outdated.

@nicolaasjan

This comment was marked as outdated.

@spaceman5

This comment was marked as outdated.

@nicolaasjan

This comment was marked as outdated.

@spaceman5

This comment was marked as outdated.

@nicolaasjan
Copy link

Synchronizing is something that sometimes doesn't work as expected,
so re-downloading a clean copy, is a sure way to get a perfect copy.

I forgot to tell, that I also apply some open pull requests, that haven't been merged yet.
#29581, #29593 and #30998.

@spaceman5

This comment was marked as outdated.

@nicolaasjan

This comment was marked as outdated.

@spaceman5
Copy link
Author

spaceman5 commented Mar 16, 2023

You're right..
Thank you.

OK the make process completed successfully.

Here is the full list of what I used:

apt install make
apt install zip
apt install pandoc
apt install python-is-python3

Now qwhen I'm inside the youtube-dl folder,
If I run youtube-dl,
this is what I get:

Command 'youtube-dl' not found, but can be installed with:
apt install youtube-dl

(the file has the x attribute..
and also I am root on this VPS, so no need to type sudo)

Here is a screenshot:
https://i.postimg.cc/pdLf169w/yt.png

@spaceman5

This comment was marked as outdated.

@nicolaasjan

This comment was marked as outdated.

@spaceman5
Copy link
Author

Right..
thank you so much man,
I must say that the pip option is definitely much more fool proof,
yet here I learned abit more..
Thank you so much

@spaceman5
Copy link
Author

Or copy it to /usr/local/bin and then you can run youtube-dl <URl> from anywhere.

I think it might be better to create a Link in /usr/local/bin,
rather than copying the executable there,
that way, If in the future I delete the copy of the repo, and redownload it (and re-make it),
the link will point to an updated executable, instead of being the old executable..

@nicolaasjan

This comment was marked as resolved.

@spaceman5
Copy link
Author

spaceman5 commented Mar 16, 2023

Glad I managed to make a small contribution here too :))

BTW,
I now did a test run on a Youtube Video,
and it seems that despite the fact that youtube-dl is running,
there are now problems during the run.

TypeError: expected string or bytes-like object

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/root/youtube-dl/./youtube-dl/main.py", line 19, in
File "/root/youtube-dl/./youtube-dl/youtube_dl/init.py", line 475, in main
File "/root/youtube-dl/./youtube-dl/youtube_dl/init.py", line 465, in _real_main
File "/root/youtube-dl/./youtube-dl/youtube_dl/YoutubeDL.py", line 2083, in download
File "/root/youtube-dl/./youtube-dl/youtube_dl/YoutubeDL.py", line 812, in extract_info
File "/root/youtube-dl/./youtube-dl/youtube_dl/YoutubeDL.py", line 819, in wrapper
File "/root/youtube-dl/./youtube-dl/youtube_dl/YoutubeDL.py", line 840, in __extract_info
File "/root/youtube-dl/./youtube-dl/youtube_dl/extractor/common.py", line 535, in extract
File "/root/youtube-dl/./youtube-dl/youtube_dl/extractor/youtube.py", line 2167, in _real_extract
File "/root/youtube-dl/./youtube-dl/youtube_dl/extractor/youtube.py", line 447, in _extract_author_var
File "/root/youtube-dl/./youtube-dl/youtube_dl/utils.py", line 1972, in get_element_by_attribute
File "/root/youtube-dl/./youtube-dl/youtube_dl/utils.py", line 1989, in get_elements_by_attribute
File "/usr/lib/python3.10/re.py", line 247, in finditer
return _compile(pattern, flags).finditer(string)
TypeError: expected string or bytes-like object

So I think I will abandon the git clone + make method,
and revert back to pip.
The pip option is definitely easier.

You really need to be able to solve problems in Linux, in order to use the make option,
and I am not there yet..

I learned things today,
but I also learned that using pip should be preferred over make, when possible..

@spaceman5
Copy link
Author

spaceman5 commented Mar 16, 2023

I created a completely new VPS,
and now did the simpler pip installation method that worked well previously.

Quite ironically,
but I now get the same error message..

Downloading webpage
WARNING: Unable to download webpage: HTTP Error 429: Too Many Requests

So is there maybe today a global problem for everyone?

Retrying to download,
leads to the same HTTP Error 429: Too Many Requests

[update]
When I try to download on a local Linux machine, it works well without Error 429..

(so maybe my git clone + make installation was perfectly fine)
.

@spaceman5

This comment was marked as resolved.

@nicolaasjan

This comment was marked as resolved.

@spaceman5

This comment was marked as resolved.

@dirkf
Copy link
Contributor

dirkf commented Mar 16, 2023

429 -> #30839.

In #31810 (comment), I guess that there must have been an earlier WARNING caused by this line extractor/youtube.py:1839 failing:

        webpage = self._download_webpage(
            webpage_url + '&bpctr=9999999999&has_verified=1', video_id, fatal=False)

After a (eg) 429 error in line 1839, trying to _extract_author_var() from a None webpage causes the crash.

At line 447, this would make it safe:

-                get_element_by_attribute('itemprop', 'author', webpage) or '',
+                get_element_by_attribute('itemprop', 'author', webpage or '') or '',

@spaceman5

This comment was marked as resolved.

@dirkf
Copy link
Contributor

dirkf commented Mar 16, 2023

Is it possible that [error 429s seen on several newly created VPSs are] not IP (or IP Range) Blocking by Youtube, and something else instead?

I doubt it, but see the issues linked from #30839.

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

No branches or pull requests

4 participants