eyecatchup / php-yt_downloader

PHP Class to download videos from YouTube.
http://eyecatchup.github.com/php-yt_downloader/
293 stars 166 forks source link

Grabbing original file location(s) failed. #10

Open nickdodd25 opened 11 years ago

nickdodd25 commented 11 years ago

Seems that this issue is back.

"Grabbing original file location(s) failed."

I just installed this for the first time on my vps (Centos 5.9) and that is all i get. I also see that 10 months ago this issue was fixed once so it must have came back again recently. If you need any more info on this issue let me know

subet commented 10 years ago

I have the same problem. All examples showing the same error message. I have Centos 6.5 (x86_64 virtuozzo – vps-1132179-16404) hosting with FFMpeg installed.

For example: http://www.youtubeindirici.com/labs/stable/example-audio-1.php

apurbapathak commented 10 years ago

Same issue on my server.

andru183 commented 10 years ago

Did anyone ever fix this? Still have this issue

abumq commented 10 years ago

Anyone?

MyDigitalNeeds commented 9 years ago

I wonder if any other installs of this software have since broken. I do not have time to figure this out, or i would.

mammuth commented 9 years ago

Get the same error.

maykbrito commented 9 years ago

hello. I found this class today and face same problem.

Here's my solution

Change line 472:

$htmlTitle = htmlentities(utf8_decode($pb_info["title"]));

With:

$htmlTitle = htmlentities(utf8_decode($pb_info["title"]), ENT_QUOTES | ENT_IGNORE, "UTF-8");

AND

line 576:

$title = htmlentities(utf8_decode($title));

With:

$title = htmlentities(utf8_decode($title), ENT_QUOTES | ENT_IGNORE, "UTF-8");
pperrin commented 9 years ago

I get this error two or three times then it works (no change just call it again!)... haven't sorted out why - but youtube must be returning different values each time(?)

neotropic2023 commented 9 years ago

NVM, was not it.

But the problem is with the crazy randomness of the string returned and used in "function get_url_map($data)"

OK, I actually think it is youtube messing with me now. My statement does work. I think with me doing way to many requests debugging, they do not like that

So again, since the string is so random, altered a bit of code in the function mentioned above.

REPLACE

           foreach($urls as $url) {
                if(preg_match('/itag=([0-9]+)&url=(.*?)&.*?/si',$url,$um))
                {
                    $u = urldecode($um[2]);
                    $tmp[$um[1]] = $u;
                }
            }

WITH

            foreach($urls as $url) {
                $lines = explode('&',$url);
                $num = '';
                $url = '';
                foreach($lines as $u){
                    $num = ((empty($num)) && (preg_match("/itag=/i",$u))) ? str_replace("itag=","",$u):$num;
                    $url = ((empty($url)) && (preg_match("/url=/i",$u))) ? str_replace("url=","",$u):$url;
                    if((!empty($url)) && ((!empty($num)))){
                        $tmp[$num] = urldecode($url);
                        break;
                    }
                }
            }
asilva732 commented 8 years ago

was this issue resolved? I'm still having this issue on line 534. I do a Cygwin environment that runs fine when just downloading videos.

Also noticed all the php scripts are missing their closing syntax (?>). Never worked with php before so pardon if I am not using the correct term.

Edit: No problems encountered with applying the two code updates above.

neotropic2023 commented 8 years ago

Even with my changes, I still get random fails. But with how I created my generator, I just have them hit a re-fetch/retry button and it works. Located here: http://www.neotropicworks.com/youtube/

Granted, nothing you can do if the file is restricted or what not.

I will have to see what they changed on this as of late. I am sure what I put up above can be improved maybe.

neotropic2023 commented 8 years ago

@asilva732

The closing PHP tags should not matter really if they are there or not. I guess would depend on the server. The script would not run period if it was an issue. I always close them any ways if I see them missing.

hersche commented 7 years ago

it looks like a fork fixed this already?

https://github.com/bascoder/php-yt_downloader/commit/48d9a6027715156551726e5a2be7e67c687489c2

not shure, just on a run-through by searching components for projects..

Levan777 commented 7 years ago

maykbrito, neotropic2023, YOU SAVED MY LIFE!! Thanks!

dom-robinson commented 6 years ago

I implemented maykbrito and neotropic2023's suggestions which have massively increased reliability.

Something else that is an issue: I added an echo here:

        $url = sprintf($this->YT_INFO_ALT, urlencode($url));

        echo nl2br ($vid_id." received as ".$url." \n");**

        if(self::curl_httpstatus($url) !== 200) {
            throw new Exception("Invalid Youtube video ID: $vid_id");
            exit(); }
        else { 
            self::set_video_id($vid_id); 
        }

It showed me that requests to videos on youtube which did not allow embedding were 'unauthorised' when they should be returning some JSON.

Once i allowed embedding on the video these files returned successfully - although occasionally the return is obviously too slow from Youtube to be 100% reliable.

Im having a think about how to make the process a little more reliable.

Lerie82 commented 6 years ago

Nothing here resolves this issue. This software does not work.

Babashov commented 5 years ago

hello. I found this class today and face same problem.

Here's my solution

Change line 472:

$htmlTitle = htmlentities(utf8_decode($pb_info["title"]));

With:

$htmlTitle = htmlentities(utf8_decode($pb_info["title"]), ENT_QUOTES | ENT_IGNORE, "UTF-8");

AND

line 576:

$title = htmlentities(utf8_decode($title));

With:

$title = htmlentities(utf8_decode($title), ENT_QUOTES | ENT_IGNORE, "UTF-8");

I did your solution but still getting this error: Grabbing original file location(s) failed. Youtube error message: HTTP is not supported.&status=fail&errorcode=180