/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function str_between($string, $start, $end){ $string = " ".$string; function get_youtube_download_link($url){ if( $url !== "") { $youtube_link = $url; //$url = get_post_meta($post->ID, 'url', true); { $v_id = str_between($youtube_page, "&video_id=", "&"); $t_id = str_between($youtube_page, "&t=", "&"); $flv_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id"; $hq_flv_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id&fmt=6"; $mp4_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id&fmt=18"; $threegp_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id&fmt=17"; echo "\t\tDownload (right-click > save as):\n\t\t"; echo "<a href=\"$flv_link\">FLV</a>\n\t\t"; echo "<a href=\"$hq_flv_link\">HQ FLV (if available)</a>\n\t\t"; echo "<a href=\"$mp4_link\">MP4</a>\n\t\t"; echo "<a href=\"$threegp_link\">3GP</a><br><br>\n"; } } }
Comments
