Comments (17)
Just tested the latest version (3.3) with the already existing API endpoints. They work! But only if called from the server itself. I'll eventually implement a public API (~v3.5 ish), hopefully we can make do with this system for now.
I put up some info on it on the README here. Will keep this issue open until a real public API is implemented.
from youtubedl-material.
Ok, I see.
Basically, the bash command you are running is not properly converting $*
, it basically thinks you are trying to put in the string $*
as the URL instead of the url argument you're trying to pass. Modify your script such that the xterm/curl command is formatted as a string rather than being a command itself. Then you can run eval
to run the string as a command, with the proper args inserted.
I wrote up an example script here:
# Run YoutubeDL-Material Video download in bash script
echo Downloading URL: $*
command="curl -XPOST -H \"Content-type: application/json\" -d '{\"url\": \"$*\"}' 'http://127.0.0.1:17442/api/tomp4'"
eval $command
That should fix your issue. Let me know if it doesn't work or you run into any other problems!
from youtubedl-material.
the xterm window stays open like 30 to 60 secs. Should not it just submit and close with the lines above?
This is likely because the API call only returns when the video finishes downloading. This is currently how the backend tells the client when the video actually finished and the client should start streaming/downloading it.
I'm planning on refactoring this in the future, so the /tomp3 and /tomp4 endpoints will return immediately, and I will use another endpoint that will check on the status/progress of the downloading file so it knows when it is done.
Maybe there's a way to tell xterm to do it quietly so it doesn't stay open, at least in the meantime?
Also does this queue downloads properly? As in can I submit ulr after url after wihtout waiting one to download first?
It doesn't queue, it actually runs the downloads simultaneously (AFAIK). I do want to add a queuing system in the future, but it isn't in the pipeline yet. In short, you are safe submitting multiple requests after another. Nothing should break unless YouTube gets mad after all the requests, which can happen after dozens of videos are downloaded in quick succession.
from youtubedl-material.
Thanks for the reply. All that sounds fine, maybe some of this can be in thw API doc.
thanks
from youtubedl-material.
No problem! Glad to help. I've updated the docs to avoid any further confusion. The front page now explains how to authenticate, and the tomp3/tomp4 endpoints have their caveats explained as well.
from youtubedl-material.
There are URL params you can use to be able to auto start a download on launch. You can use this to automate the process, but it does require going to the webpage. I'll keep this idea in mind, hopefully I can get it in the next update.
Any particular API calls (other than downloading) that would interest you?
from youtubedl-material.
Hi
I am personally interested in some kind of way to pass Youtube url to download it remotely.
As an example, I use another Youtube download with the line below
curl -X POST --data-urlencode "url=$*" http://192.168.1.100:6000/youtube-dl/q
This works but your application much nicer to use as a web frontend.
from youtubedl-material.
THanks forr the reply.
Will this queue the requests or does it need to finish the existing one to be able to accept/submit another url via command line?
from youtubedl-material.
Hi
I tried to use this in a command line but this is what I get
I use $*
to pass the url pass from the command line, which works in other youtube scripts.
ERROR: u'$*' is not a valid URL. Set --default-search "ytsearch" (or run youtube-dl "ytsearch:$*" ) to search YouTube
Here is the line
xterm -e curl -XPOST -H "Content-type: application/json" -d '{"url": "$*"}' 'http://127.0.0.1:12000/api/tomp4'
from youtubedl-material.
Just curious, what's the benefit of using $*
over manually putting in the URL? Reason I ask is because it isn't currently possible to pass bash arguments like that into the youtube-dl download command (it is running in a separate shell after all, so even if it could, $*
would probably refer to app.js
).
So if you could make do with manually putting in the URL in the curls, then that should work fine. Otherwise, maybe you can make a wrapper script that will take $*
from the command line and inject it into that xterm command. Just a thought.
from youtubedl-material.
I would like to use it in a script, it kind of does not make sense to manually type a url into a bash script if you will.
I use a Firefox addon (called External Application Button) that lets me pass a youtube video url to a bash script. That is what I am trying to do atm.
from youtubedl-material.
Just finished implementing the public API! I've put the documentation up here. All the endpoints are there with their input and outputs, but it could use some introductory text and other hints.
In the next update (which is just about feature-complete now), you can enable the public API and generate an API key in the settings menu. This API key is the authorization token which you need to use the public API outside of localhost.
Thanks for the suggestion! I'm gonna close this issue, but feel free to open up another one if you have any other ideas/comments about the API.
from youtubedl-material.
Hi
So how do I use the new API key with the lines I have been using? I checked the doc but I am not seeing any example.
command="xterm -e curl -XPOST -H \"Content-type: application/json\" -d '{\"url\": \"$*\"}' 'http://192.168.2.1:12000/api/tomp4'"
eval $command
from youtubedl-material.
I should update the docs to show this. Basically, you need to add an authorization token, it looks something like this:
-H "Authorization: API_KEY"
Just replace API_KEY with your actual key, and make sure there's a space between 'Authorization:' and the API key.
Let me know if you have any issues implementing this!
from youtubedl-material.
Thanks. I am getting "empty reply from the server with the new addition"
"curl -XPOST -H \"Authorization: 22d45dd2-d11d-426f-82ef-d5c391ad5c0e Content-type: application/json\" -d '{\"url\": \"$*\"}' 'http://192.168.2.1:12000/api/tomp4'"
from youtubedl-material.
Thanks. I am getting "empty reply from the server with the new addition"
Can you try separating the -H
into two separate args? Like so:
"curl -XPOST -H \"Content-type: application/json\" -H \"Authorization: 22d45dd2-d11d-426f-82ef-d5c391ad5c0e\" -d '{\"url\": \"$*\"}' 'http://192.168.2.1:12000/api/tomp4'"
Let me know if this helps
from youtubedl-material.
Thanks I think that works, but it seems like the submission is extremely slow, the xterm window stays open like 30 to 60 secs. Should not it just submit and close with the lines above?
Also does this queue downloads properly? As in can I submit ulr after url after wihtout waiting one to download first?
from youtubedl-material.
Related Issues (20)
- [FEATURE] Is it possible to override the download path for subscription
- [BUG] Container will not be able to run properly non-privileged HOT 1
- [FEATURE] Set default max quality in config
- How to reset Users account ?
- [BUG] Content does not refresh when switching between subs using side menu
- [BUG] Scheduling a task hangs application, won't start fully HOT 1
- [FEATURE] Make mounted folders paths configurable using environment variable
- [BUG]
- [BUG] Searching goes on forever HOT 2
- YoutubeDl material doesnt download a subscription. HOT 3
- [BUG] pm2 not declared as dependency
- [BUG] Skipping player responses from android clients HOT 1
- [BUG] Can't add subscriptions. It just loads forever and never adds the channel.
- [BUG] container won't start HOT 8
- [BUG] Video file name too long error
- [BUG] Thumbnails don't load if their path contains a "%" character HOT 1
- I'm looking for the best way to set the codecs for downloads
- [BUG] Cant delete individual notifications
- [BUG] Should install mutagen when program installed (esp. for Docker)
- [FEATURE] Explain execa, delimiters, argument usage better & include some helpful messages when people enter custom args
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtubedl-material.