USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

youtube.com video ripper
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Shell Scripting and Programming
View previous topic :: View next topic  
Author Message
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Wed Jul 12, 2024 10:08 pm    Post subject: youtube.com video ripper Reply with quote

Code:

#!bin/bash
bu="http://youtube.com/get_video.html?";mkdir -p ~/YouTube;cd ~/YouTube;read -p "YouTube url? " ur;read -p "Name? " nv
wget ${ur} -O /tmp/y1;uf=${bu}`grep player2.swf /tmp/y1 | cut -d? -f2 | cut -d\" -f1`;wget "${uf}" -O /tmp/y.flv
ffmpeg -i /tmp/y.flv -ab 56 -ar 22050 -b 500 -s 320x240 ${nv}.mpg;rm /tmp/y.flv; rm /tmp/y1;rm gmon.out; exit


4 Lines !!!! Smile

This script will rip the .flv file from a youtube.com url, and convert it to a .mpg video file...
...........................................................................................................................................................................................................................................................................................................................................



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11


Last edited by crouse on Thu Jul 13, 2024 12:06 am; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
VHockey86
Advanced Member


Joined: 12 Dec 2024
Posts: 988
Location: Rochester

PostPosted: Wed Jul 12, 2024 10:25 pm    Post subject: Reply with quote

Well, the first line isn't really needed (you can always just type "bash scriptname") Very Happy



_________________
Main Desktops : Kubuntu 10.4. ArchLinux 64-bit. Windows7 64-bit. Windows XP 32-bit.

MacBook: OS X Snow Leopard (10.6)
Back to top
View user's profile Send private message
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Thu Jul 13, 2024 12:04 am    Post subject: Reply with quote

well......

actually i just added the following code to my .bashrc file....

Code:
alias ytr='/home/crouse/Scripts/ytr.sh'


so now i just type

ytr Very Happy



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
unreal.geek
Member


Joined: 21 Sep 2024
Posts: 202
Location: /dev/random

PostPosted: Thu Jul 13, 2024 5:33 am    Post subject: Reply with quote

Great Work, that is very useful Very Happy



_________________
Gentoo kernel 2.6.18-rc4-no2
Back to top
View user's profile Send private message Send e-mail AIM Address
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Thu Jul 13, 2024 8:39 pm    Post subject: Reply with quote

A very cool url ...........

http://keepvid.com/


Download vids from ALMOST any site Wink



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
lberg
Sr. Member


Joined: 28 Jul 2024
Posts: 1289

PostPosted: Sat Jul 15, 2024 9:50 pm    Post subject: Reply with quote

cool!!!! thx
Smile



_________________
2 Computers: Arch Linux, 64-bit
3 Computers: Arch Linux, 32-bit
Back to top
View user's profile Send private message
crudball
Advanced Member


Joined: 01 Sep 2024
Posts: 892
Location: Stratford - U.K

PostPosted: Sun Jul 16, 2024 8:59 am    Post subject: Reply with quote

Great work crouse - althought it is much easier to understand if it isn't condensed to 4 lines.
Code:

#!bin/bash
bu="http://youtube.com/get_video.html?"
mkdir -p ~/YouTube
cd ~/YouTube
read -p "YouTube url? " ur
read -p "Name? " nv
wget ${ur} -O /tmp/y1
uf=${bu}`grep player2.swf /tmp/y1 | cut -d? -f2 | cut -d\" -f1`
wget "${uf}" -O /tmp/y.flv
ffmpeg -i /tmp/y.flv -ab 56 -ar 22050 -b 500 -s 320x240 ${nv}.mpg
rm /tmp/y.flv
rm /tmp/y1
rm gmon.out
exit

Also that helps people are learning bash. Can you please annotate this script so I can see what each bit does?



_________________
I'm back Smile
Back to top
View user's profile Send private message Send e-mail MSN Messenger
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Mon Jul 17, 2024 1:03 am    Post subject: Reply with quote

The script is expanded on bashscripts.org ...... the final version was the condensed one. You can however see what I did revision-wise on bashscripts.



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
VHockey86
Advanced Member


Joined: 12 Dec 2024
Posts: 988
Location: Rochester

PostPosted: Mon Jul 17, 2024 2:29 am    Post subject: Reply with quote

Quote:
Can you please annotate this script so I can see what each bit does?


Ya, crouse never learned programming with some CS prof yelling at him to comment the code. Very Happy



_________________
Main Desktops : Kubuntu 10.4. ArchLinux 64-bit. Windows7 64-bit. Windows XP 32-bit.

MacBook: OS X Snow Leopard (10.6)
Back to top
View user's profile Send private message
shebang
Sr. Member


Joined: 08 Jan 2024
Posts: 1104
Location: Chicago

PostPosted: Mon Aug 21, 2024 1:01 am    Post subject: Reply with quote

You should do some error debugging so that if ffmpeg is not found or the conversion to mpg doesn't work, you should NOT delete the y.flv - which is painful to re-download again... Sad - just happened to me.



_________________
Ubuntu Linux Feisty Fawn 7.04
Back to top
View user's profile Send private message Visit poster's website
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Mon Aug 21, 2024 5:07 am    Post subject: Reply with quote

rofl.. dude, i wrote it simply so my kid could download youtube vids.... it works fine for what i wrote it for..... if you WANT to do error checking ..... feel free Very Happy Very Happy

I KNEW ffmpeg was on my machine..... and i didn't want the flv files filling up my hard drive Wink



_________________
Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
Back to top
View user's profile Send private message Visit poster's website AIM Address
jada
Linux Guru


Joined: 13 May 2024
Posts: 3064
Location: Sun City, CA 92585

PostPosted: Mon Aug 21, 2024 5:52 am    Post subject: Reply with quote

But is it not easier when your kids using Firefox and the extension "Flash Dowloader" Confused

I know you like script's Smile



_________________
openSUSE 11.1 Desktop KDE 4.3.1 buildservice Factory
Linux Mint 7 Desktop Gnome
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
HaniMan
New Member


Joined: 01 Oct 2024
Posts: 1

PostPosted: Sun Oct 01, 2024 5:05 am    Post subject: Reply with quote

Cool script Smile

But when i want videos from youtube and google i use youtube ripper to download them - find it more easy to do it that way Wink


Back to top
View user's profile Send private message
inactive
Sr. Member


Joined: 29 Aug 2024
Posts: 1207

PostPosted: Wed Aug 26, 2024 6:42 am    Post subject: Reply with quote

Quick question (I hope), anyone have any clue howcome with the youtube download script I get this every single time for the last couple of weeks, both in Cooker, and in MDV 2024.1?:
Code:
$ sh youtube2.sh
What is the youtube.com url you want to rip ? http://www.youtube.com/watch?v=oW0vhNRMFVQ&feature=related
What would you like to name the video (no spaces in the name) ? news_reporter_slip-up
--2009-08-26 00:35:29--  http://www.youtube.com/watch?v=oW0vhNRMFVQ&feature=related
Resolving www.youtube.com... 74.125.53.102, 74.125.53.113, 74.125.53.139, ...
Connecting to www.youtube.com|74.125.53.102|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `urlsource.txt'

    [   <=>                                 ] 112,014      235K/s   in 0.5s   

2009-08-26 00:35:35 (235 KB/s) - `urlsource.txt' saved [112014]

http://youtube.com/get_video.html?
--2009-08-26 00:35:35--  http://youtube.com/get_video.html?
Resolving youtube.com... 208.117.236.69, 64.15.120.233
Connecting to youtube.com|208.117.236.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.youtube.com/get_video.html? [following]
--2009-08-26 00:35:40--  http://www.youtube.com/get_video.html?
Resolving www.youtube.com... 74.125.53.102, 74.125.53.113, 74.125.53.139, ...
Connecting to www.youtube.com|74.125.53.102|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2009-08-26 00:35:46 ERROR 404: Not Found.

mv: cannot stat `*': No such file or directory
Now converting the file to mpeg ... this can take awhile, please be patient
--------------------------------
tovid
DVD and (S)VCD video conversion script
Version 0.31
http://www.tovid.org
--------------------------------
Using config file /home/myuser/.tovid/tovid.config, containing the following options:
(none)
tovid command-line used:
-in *.flv -out news_reporter_slip-up -half-dvd -ntsc -ffmpeg -keepfiles
Could not find input file /home/myuser/YouTube/tmp/*.flv. Exiting.
mv: cannot stat `*.mpg': No such file or directory


I have everything needed installed:
Code:
$ rpm -qa | grep ffmpeg
gstreamer0.10-ffmpeg-0.10.8-1mdv2010.0
qmmp-ffmpeg-0.3.0-1mdv2010.0
ffmpeg-0.5-1plf2009.1
libffmpeg52-0.5-1plf2009.1
libffmpegthumbnailer3-1.5.4-1mdv2010.0
ffmpegthumbnailer-1.5.4-1mdv2010.0

$ rpm -qa | grep tovid
tovid-0.31-5mdv2009.1


Here's the script, and it's always worked til recently:
Code:
$ cat youtube2.sh
#!/bin/bash
# by Crouse
# Program name ytr = YouTube.com Ripper
baseurl="http://youtube.com/get_video.html?"
mkdir -p ~/YouTube ;
mkdir -p ~/YouTube/tmp ;
cd ~/YouTube/tmp ;
read -p "What is the youtube.com url you want to rip ? " urltorip ;
read -p "What would you like to name the video (no spaces in the name) ? " nameofvideo ;
wget ${urltorip} -O urlsource.txt ;
grep "watch_fullscreen" urlsource.txt > url.info;
videourl=`sed "s;.*\(video_id.\+\)&title.*;\1;" url.info`;
fullurl=${baseurl}${videourl};
echo ${fullurl};
rm *;
wget ${fullurl};
mv * *.flv;
echo "Now converting the file to mpeg ... this can take awhile, please be patient" ;
tovid -in *.flv -out ${nameofvideo} -half-dvd -ntsc -ffmpeg -keepfiles;
mv *.mpg ../;
rm -Rf ~/YouTube/tmp;
exit

Right now, this isn't even working for me:
HaniMan wrote:
i use youtube ripper to download them - find it more easy to do it that way Wink

When I put the url in, and click "Download the video", it just goes to a blank page.



_________________
Mandriva 2024.1 PWP
Mandriva Cooker
ArtistX live
Back to top
View user's profile Send private message
inactive
Sr. Member


Joined: 29 Aug 2024
Posts: 1207

PostPosted: Sat Aug 29, 2024 9:45 pm    Post subject: Reply with quote

Bump...



_________________
Mandriva 2024.1 PWP
Mandriva Cooker
ArtistX live
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Shell Scripting and Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse