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

Cant get youtube-dl get working as an function #5607

Closed
WeWin55 opened this issue May 4, 2015 · 6 comments
Closed

Cant get youtube-dl get working as an function #5607

WeWin55 opened this issue May 4, 2015 · 6 comments

Comments

@WeWin55
Copy link

@WeWin55 WeWin55 commented May 4, 2015

So I dont know why I cant get youtube-dl get working as a function.
I tested also to just do loady --help but that doesnt work either.
I need help. Sry.

Here my test script:
loady () {
/usr/local/bin/youtube-dl -f 144
}

loady https://www.youtube.com/watch?v=XpTZlXn3pxY

My final code should look like that:

youtube1=""
youtube2=""
loady () {
/usr/local/bin/youtube-dl [options]
}

loady $youtube1 $youtube2

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 4, 2015

Assuming this is shell script, you forgot to specify the arguments when you call youtube-dl that has been passed to your function. It should look alike this:

/usr/local/bin/youtube-dl -f 144 $1
@dstftw dstftw closed this May 4, 2015
@WeWin55
Copy link
Author

@WeWin55 WeWin55 commented May 4, 2015

No i didnt forget that.
It should get the --reject option and then look at the url but it doesnt.

Here is my script:
(silly github formation, its always one line)

loady () {
/usr/local/bin/youtube-dl --playlist-end 7 -w -r 1000K --no-mtime --write-thumbnail --output '%(uploader)s - %(title)s - %(resolution)s.%(ext)s' --date $(date +"%Y%m%d")
}

loady --reject-title "bloodborne|creed|hex|fifa|league|storm" "https://www.youtube.com/user/PietSmittie/videos?&ab_channel=PietSmiet"

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 4, 2015

Re-read my answer carefully. Arguments you pass to loady outside (--reject-title, "bloodborne|creed|hex|fifa|league|storm" and "https://www.youtube.com/user/PietSmittie/videos?&ab_channel=PietSmiet" in your case) are not passed to youtube-dl call inside script. You can access them within script using $1, $2, $3 and so on or $@ array.

@WeWin55
Copy link
Author

@WeWin55 WeWin55 commented May 4, 2015

So I have to do?:

1="--reject-title "bloodborne|creed|hex|fifa|league|storm""
2="https://www.youtube.com/user/PietSmittie/videos?&ab_channel=PietSmiet"

loady () {
/usr/local/bin/youtube-dl --playlist-end 7 -w -r 1000K --no-mtime --write-thumbnail --output '%(uploader)s - %(title)s - %(resolution)s.%(ext)s' --date $(date +"%Y%m%d")
}

loady $1 $2

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 4, 2015

You are totally misusing it. I suggest you starting here.

@WeWin55
Copy link
Author

@WeWin55 WeWin55 commented May 4, 2015

ohh I think you mean i should do that:

options="--playlist-end 7 -w -r 1000K --no-mtime --write-thumbnail --output '%(uploader)s - %(title)s - %(resolution)s.%(ext)s' --date $(date +"%Y%m%d")"
url="https://www.youtube.com/user/PietSmittie/videos?&ab_channel=PietSmiet"

/usr/local/bin/youtube-dl $1 §2

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.