Click here to Skip to main content
Click here to Skip to main content

Tagged as

One Line of code to download youtube's flv file in php

, 25 Mar 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
One Line of code to download youtube's flv file in php
$video_id is the id of youtube video
$video_path is the saving path
 

exec('wget -t 2 --cookies=on --keep-session-cookies --save-cookies=/home/cookie.txt http://www.youtube.com/get_video_info?video_id='.$video_id.' -qO- | sed -n "/fmt_url_map/{s/[\\&]/\\n/g;p}" | sed -n \'/^fmt_url_map=/p\' | sed -n "s/\\%7C/\\n/g;p" | sed -n \'/itag%3D5/p\'| sed \'s/%3A/:/g;s/%2F/\\//g;s/%3F/\\?/g;s/%3D/=/g;s/%26/\\&/g ;s/%25/%/g \' | wget --cookies=on --load-cookies=/home/cookie.txt -i - -O '.$video_path);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

gxtiou

United States United States
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 5 it works Pinmembermraiur7-Apr-11 4:28 
GeneralReported PinmentorTrollslayer26-Mar-11 2:32 
QuestionWhy one line? PinsubeditorIndivara23-Mar-11 21:43 
AnswerRe: Why one line? PinmvpHenry Minute24-Mar-11 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141216.1 | Last Updated 25 Mar 2011
Article Copyright 2011 by gxtiou
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid