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

Now PHP support is broken?? #2490

Open
DanDon opened this issue Mar 1, 2014 · 9 comments
Open

Now PHP support is broken?? #2490

DanDon opened this issue Mar 1, 2014 · 9 comments

Comments

@DanDon
Copy link

@DanDon DanDon commented Mar 1, 2014

If have had Youtube-DL implemented on a website of mine for a while now, using PHP to back-end run the youtube-dl with a POST'd youtube link and then embed the resulting downloaded MP4 inside an HTML5 video tag. To bypass youtube filtering among other things. The problem I have is that the most recent youtube-dl.exe, possibly due to Youtube changing the way their videos work, no longer uses one command line process to finish. Therefore PHP assumes the command has completed before the video has downloaded and quits out of the command.
This only happens for links that have encrypted videos (like Vevo). All other normal videos work fine. I presume this is due to Youtube-dl being able to capture these in one command.
Any ideas or possibility of a fix?? Thanks in advance

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 1, 2014

Could you post some log or at least the command you are using?
I've never seen something similar to what you are saying, the videos are downloaded with a single invocation to youtube-dl. Of course if there's some problem during the download (like network errors) it will exit without finishing the download, but that's normal.

@DanDon
Copy link
Author

@DanDon DanDon commented Mar 1, 2014

In the PHP head I am assigning a variable to
youtube-dl.exe --get-id LINK
Then I am running exec() to the Windows command line of
youtube-dl.exe --id LINK
and then having the HTML5 video embed the --id with an mp4 extension to play the downloaded video. Worked beautifully before but now the PHP finishes the command early and tries to embed a video that isn't there yet!

When outputting the PHP command to a txt file it shows that it stops on "Downloading JS Player":

[youtube] Setting language
[youtube] 0KSOMA3QBU0: Downloading webpage
[youtube] 0KSOMA3QBU0: Downloading video info webpage
[youtube] 0KSOMA3QBU0: Extracting video information
[youtube] 0KSOMA3QBU0: Encrypted signatures detected.
[youtube] 0KSOMA3QBU0: Downloading js player vfl1LZyZ5

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 1, 2014

Could you post what you get if you add to the command the --verbose option?

@DanDon
Copy link
Author

@DanDon DanDon commented Mar 1, 2014

The above at the end of my comment is the verbose output of what I get before it stops

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 1, 2014

There's some missing output, it should start with:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['0KSOMA3QBU0']
[debug] youtube-dl version 2013.09.12

(you may need to also capture the standard error output, I don't know how to do that in php)
By the way, can you reproduce it outside a PHP program (i.e. in the command prompt)?

@DanDon
Copy link
Author

@DanDon DanDon commented Mar 1, 2014

Ah the output to txt file doesn't give the full verbose info.. this is copied out of the terminal:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--id', '-v', 'http://www.youtube.com/watch?v=txBfhpm1jI0']
[debug] Encodings: locale 'cp1252', fs 'mbcs', out None, pref: 'cp1252'
[debug] youtube-dl version 2014.02.28
[debug] Python version 2.7.5 - Windows-8-6.2.9200
[debug] Proxy map: {}

Stops here

@DanDon
Copy link
Author

@DanDon DanDon commented Mar 1, 2014

I get the correct result if I run the same command directly in the command line by the way. So it all works fine on the machine but not when using PHP. PHP can run commands in the terminal from a webpage fine as long as the command doesn't go off somewhere else or not send back info to say it's still going.
The annoying thing is that this did work perfectly fine :( I've only updated Youtube-dl and the server and PHP are the same as they have been. Can't remember now what version of youtube-dl worked, otherwise I'd try it; I'm guessing it's been updated though because the old one doesn't work with YouTube anymore, so probably wouldn't help :'(

@DanDon
Copy link
Author

@DanDon DanDon commented Mar 1, 2014

If it helps you understand it:
http://www.windowsdan.com/web
and use the youtube proxy search.

@aerickson
Copy link

@aerickson aerickson commented Oct 18, 2016

Seems like a PHP question more than youtube-dl. I think you just need to select a different way of running the command in PHP. The link below might help.

http://stackoverflow.com/questions/8424961/how-to-wait-for-a-process-to-terminate-and-also-wait-for-the-corresponding-chil

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
3 participants
You can’t perform that action at this time.