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

youtube-dl in php not working(extract audio) #5752

Closed
TheGr33k opened this issue May 19, 2015 · 3 comments
Closed

youtube-dl in php not working(extract audio) #5752

TheGr33k opened this issue May 19, 2015 · 3 comments

Comments

@TheGr33k
Copy link

@TheGr33k TheGr33k commented May 19, 2015

$url=exec("youtube-dl -g https://www.youtube.com/watch?v=mk48xRzuNvA"); works perfectly but the following doesn't seems to execute on the server

exec("youtube-dl -x --audio-format mp3 -f 18 -o \"%(title)s.%(ext)s\" https://www.youtube.com/watch?v=mk48xRzuNvA");

However if i load the equivalent command in commandline it works just fine

youtube-dl -x --audio-format mp3 -f 18 -o "%(title)s.%(ext)s" https://www.youtube.com/watch?v=mk48xRzuNvA

Is there something wrong with the way i escape the command in php or something

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 19, 2015

Post the output of running this in php:
echo system("youtube-dl -x --audio-format mp3 -f 18 -o \"%(title)s.%(ext)s\" -v https://www.youtube.com/watch?v=mk48xRzuNvA 2>&1");

@TheGr33k
Copy link
Author

@TheGr33k TheGr33k commented May 19, 2015

[youtube] mk48xRzuNvA: Downloading webpage [youtube] mk48xRzuNvA: Extracting video information [youtube] mk48xRzuNvA: Downloading js player en_US-vflHV7Wup WARNING: Writing cache to u'/home/nginx/.cache/youtube-dl/youtube-sigfuncs/js_en_US-vflHV7Wup_40.41.json' failed: Traceback (most recent call last): File "/usr/local/bin/youtube-dl/youtube_dl/cache.py", line 46, in store os.makedirs(os.path.dirname(fn)) File "/usr/lib64/python2.6/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.6/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.6/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.6/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/home/nginx' [youtube] mk48xRzuNvA: Downloading DASH manifest ERROR: unable to open for writing: [Errno 13] Permission denied: 'The Script - Hall of Fame ft. will.i.am.mp4.part' ERROR: unable to open for writing: [Errno 13] Permission denied: 'The Script - Hall of Fame ft. will.i.am.mp4.part'

Seems to be a permission issue....how to fix that

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 19, 2015

Set output template to the location that is writable by the user account php is running under.

@dstftw dstftw closed this May 19, 2015
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.