User Tools

Site Tools


youtube:download_a_youtube_video

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

youtube:download_a_youtube_video [2016/07/10 19:19] – created peteryoutube:download_a_youtube_video [2019/12/04 22:48] (current) – removed peter
Line 1: Line 1:
-====== Youtube - Download a Youtube video ====== 
  
-Youtube used to create temporary files in /tmp whenever a video was watched.  The temporary file, named similar to /tmp/FlashXX*/ remained there while the webpage was kept open.  To make a copy of the video was a simple task of copying the temporary file elsewhere: 
- 
-</code bash> 
-cp /tmp/FlashXX* /videos_to_keep 
-</code> 
- 
- 
-However, newer versions of flash (since  10.2r152 in Linux) have changed that.  The temporary file no longer exists. 
- 
-The following bash script allows one to download a youtube video. 
- 
-<code bash> 
-#!/bin/bash 
-# 
-# Download Youtube Video 
-# 
-# Two arguments 
-#   $1 Youtube URL 
-#   $2 You name for the video 
-# 
- 
-wget -c --no-check-certificate --user-agent="" $1 -qO- | \ 
-sed 's/\\u0026/\&/g'| \ 
-awk '/fmt_url_map/{gsub(/[\|\"]/,"\n");print}' | \ 
-sed -n "/^fmt_url_map/,/videoplayback/p" | \ 
-sed -e :a -e '$q;N;2,$D;ba' | tr -d '\n' | \ 
-sed -e "s/\(.*\),\(.\)\{1,3\}/\1/;s/\\\//g" | \ 
-wget -c --no-check-certificate --user-agent="" -i - -O $2.flv 
-</code> 
- 
-After putting in in a file and making it executable just go get your YouTube url and fire off the download.  Here's an example. 
- 
-<code bash> 
-./ytd.sh 'http://www.youtube.com/watch?v=J---aiyznGQ' keycat 
-</code> 
- 
-This will make the file keycat.flv in your dir.  Use a recent VLC or Mplayer to play the file. 
- 
-Its very likely that this script will be out of date (broken) soon but hopefully it will be a good blueprint for anyone else in the future.  
youtube/download_a_youtube_video.1468178380.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki