Using get_video on YouTube to upload videos

I am trying to get the video url of any YouTube video as follows:

Open

http://youtube.com/get_video_info?video_id=VIDEOID 

then take the value of the account_playback_token token and open this url:

 http://www.youtube.com/get_video?video_id=VIDEOID&t=TOKEN&fmt=18&asv=2 

This should open the page only with the video or start downloading the video. But nothing happens, the Safari activity window says β€œNot Found”, so something is wrong with the URL. I want to integrate this into an iPad application, and the javascript method to get the URL of the video that I use in the iPhone version of the application does not work, so I need a different solution.

YouTube is constantly changing, and I think the URL is just out of date. Please, help:)

Edit: It seems the get_video method no longer works. I would really appreciate it if someone could tell me another way to find the video url.

Thank you, I really need help.

+6
source share
3 answers

Sorry, this is no longer possible. They limit the IP token that received it.

Here's a workaround using the get_headers() function, which gives you an array with a link to the video. I don't know anything about ios , so hopefully you can rewrite this PHP code yourself.

 <?php if(empty($_GET['id'])) { echo "No id found!"; } else { function url_exists($url) { if(file_get_contents($url, FALSE, NULL, 0, 0) === false) return false; return true; } $id = $_GET['id']; $page = @file_get_contents('http://www.youtube.com/get_video_info?&video_id='.$id); preg_match('/token=(.*?)&thumbnail_url=/', $page, $token); $token = urldecode($token[1]); $get = $title->video_details; $url_array = array ("http://youtube.com/get_video?video_id=".$id."&t=".$token, "http://youtube.com/get_video?video_id=".$id."&t=".$token."&fmt=18"); if(url_exists($url_array[1]) === true) { $file = get_headers($url_array[1]); } elseif(url_exists($url_array[0]) === true) { $file = get_headers($url_array[0]); } $url = trim($file[19],"Location: "); echo '<a href="'.$url.'">Download video</a>'; } ?> 
+9
source

I use this and it swings: http://rg3.github.com/youtube-dl/

Just copy the YouTube URL from your browser and run this command with the YouTube URL as the only argument. He will determine how to find high quality video and download it for you.

+3
source

Excellent! I needed a way to capture a whole playlist of videos.

On Linux, this is what I used:

y = http://www.youtube.com ; e = "http://gdata.youtube.com/feeds/api/playlists/PLeHqhPDNAZY_3377_DpzRSMh9MA9UbIEN?start-index=26"; for I'm in $ (curl -s $ f | grep -o "url = '$ y / watch? v = [^'] '"); do d = $ (echo $ i | sed 's | url \ =' $ y / watch? v = (.) &. * '| \ 1 | "); YouTube-DL --restrict-filenames" $ y / watch? v = $ d "; done

You should find the playlist ID from the common Youtube URL, for example: https://www.youtube.com/playlist?list=PLeHqhPDNAZY_3377_DpzRSMh9MA9UbIEN

In addition, this method uses the gdata API, limiting 25 entries per page.
Therefore, the parameter "start-index = 26" (to get page 2 in my example)

This may use some cleanup and additional logic to iterate over all 25 sets.

Credits:

fooobar.com/questions/904638 / ...

http://www.commandlinefu.com/commands/view/3154/download-youtube-playlist (which by itself does not quite work)

+1
source

Source: https://habr.com/ru/post/904638/


All Articles