Click here to Skip to main content
11,573,084 members (64,889 online)
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 10.2K 7
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

You may also be interested in...

Comments and Discussions

 
GeneralReason for my vote of 5 it works Pin
mraiur7-Apr-11 3:28
membermraiur7-Apr-11 3:28 
GeneralReported Pin
Trollslayer26-Mar-11 1:32
mentorTrollslayer26-Mar-11 1:32 
QuestionWhy one line? Pin
Indivara23-Mar-11 20:43
subeditorIndivara23-Mar-11 20:43 
AnswerRe: Why one line? Pin
Henry Minute24-Mar-11 4:56
mvpHenry Minute24-Mar-11 4: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
Web04 | 2.8.150624.2 | Last Updated 25 Mar 2011
Article Copyright 2011 by gxtiou
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid