Archivo

Entradas Etiquetadas ‘youtube’

See YouTube Videos On Small Browser

jueves, 18 de septiembre de 2008 Albertux 2 comentarios

See YouTube Videos On Small Browser

Here is the python source code:

#!/usr/bin/python
# albertux <albertoi7@gmail.com>
# see a mini youtube video on resizable window
# this script could be better
 
import sys
 
if (len(sys.argv)==1) :
    print "~$ script url_video"
    sys.exit() # exit if not url
URL = sys.argv[1]
 
import gtk
import gtkmozembed
import re
 
# id of the YouTube Video
m = re.search('(?<=v=).{11}',URL)
id = m.group(0)
 
# html code to render on the small web browser
data ='<body style="background-color:black"><object width="100%" height="100%"><param name="movie" value="http://www.youtube.com/swf/l.swf?video_id='+id+'&rel=1&iurl=null&color1=0x2b405b&color2=0x6b8ab6&autoplay=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/swf/l.swf?video_id='+id+'&rel=1&iurl=null&color1=0x2b405b&color2=0x6b8ab6&autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" width="100%" height="100%"></embed></object></body>'
 
def CloseWindow(caller_widget):
    """Close the window and exit the app"""
    gtk.main_quit()
 
win = gtk.Window()
win.set_title("Small Web Browser")
win.set_position(gtk.WIN_POS_NONE) # general put the window on the top left corner
win.set_resizable(True) # resizable window
win.connect("destroy", CloseWindow)
 
gtkmozembed.set_profile_path("/tmp", "simple_browser_user")
mozbrowser = gtkmozembed.MozEmbed() # gtkmozembed
 
win.add(mozbrowser)
win.show_all()
 
mozbrowser.set_size_request(272,223) #size of the window
# show the video on the small web browser
mozbrowser.render_data(data, long(len(data)), 'file:///', 'text/html')
 
gtk.main()

Screens:

Im think write a support for wuapi, megavideo and other videosites.

Categories: unix/linux, web Tags: , , ,

YouTube++ Download and Converter

lunes, 15 de septiembre de 2008 Albertux Sin comentarios

YouTube++ Download and Converter

Necesitas: Perl, wget, ffmpeg y este script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl
use LWP::Simple;
print "YouTube++ (URL's to MP3's) By Albertux\n[http://albertux.ayalasoft.net]\n";
 
$total = @ARGV;
 
if ($total==0) {
 
	print "\nExample: ~\$ youtube\+\+ url1 url2 url3 ...\n";
 
} else {
 
	foreach(@ARGV) {
 
		$URL = $_;
		$aux = index($URL,"?v=");
		$a = substr $URL,$aux+3,11;
		$content = get($URL);
		@lines = split("\n",$content);
 
		foreach(@lines) {
			my $aux = index($_,"&t=");
			if ($aux > -1) {
				$t = substr $_, $aux+3,32;
			}
		}
		system "wget -c -O \"$a.flv\" \"http://youtube.com/get_video?video_id=$a&t=$t\"";
		system "ffmpeg -i \"$a.flv\" -ab 128k \"$a.mp3\"";
	}
}
print "\nFeedback to: <albertoi7\@gmail.com>\n";

Ejemplo tu tienes un archivo con las urls de algunos videos (YouTubeUrls.txt):

http://www.youtube.com/watch?v=-j39ABZyzek
http://www.youtube.com/watch?v=5cGvzApDZKI
http://www.youtube.com/watch?v=w1mgEQTMVB8
...

Este script bajara todos los archivos flv y los convertira a mp3.

youtube++ `cat YouTubeUrls.txt`
Categories: unix/linux, web Tags: ,

Insert Any Video Of YouTube

sábado, 23 de agosto de 2008 Albertux Sin comentarios

Insert Any Video Of YouTube

Hice esta pequeña funcion de Javascript que nos proporciona insertar cualquier Video de YouTube en un <div>.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Script: YouTubeVideo Version 1.0 (2008/07/22)
// Author: Alberto Isaac Ayala Esquivias (Albertux)
// Licence: http://creativecommons.org/licenses/by-nc-sa/3.0/
// FeedBack to: albertoi7@gmail.com
// About: Insert youtube video on a div doesn't matter if embed code is disable this script insert the video.
 
function YouTubeVideo(id,url) {
 
	var video_html ='<object width="425" height="344"><param name="movie" value="http://www.youtube.com/swf/l.swf?video_id=VIDEO&rel=1&iurl=null&autoplay=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/swf/l.swf?video_id=VIDEO&rel=1&iurl=null&autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>';
 
	var n = url.indexOf('v=');
 
	var id_video = url.substring(n+2,n+14);
 
	document.getElementById(id).innerHTML=video_html.replace(/VIDEO/g, id_video);
 
}

Modos de uso:

<input type="button" onclick="YouTubeVideo('contenedor','http://www.youtube.com/watch?v=7ykWgiZVJe0');" value="Watch  Video">
 
<div id="contenedor"></div>
  

Cuando carga la pagina:

// JavaScript onload event example:
window.onload = function() { YouTubeVideo('contenedor','http://www.youtube.com/watch?v=7ykWgiZVJe0'); }
 
// jQuery example:
$(document).ready(function() {
	YouTubeVideo('contenedor','http://www.youtube.com/watch?v=7ykWgiZVJe0');
});
Categories: web Tags: ,

YouTube URL2MP3 Perl

lunes, 4 de agosto de 2008 Albertux Sin comentarios

YouTube URL2MP3 Perl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
use LWP::Simple;
print "\nYouTube URL to MP3 Beta By Albertux [2008-08-04]\n";
print "[http://albertux.ayalasoft.net/2008/08/04/youtube-url2mp3-perl/]\n\n";
$total= @ARGV;
if ($total < 2) {
	print "Use: \$perl url2mp3.pl url_video name_video\n\n";
}
else {
	$URL=$ARGV[0];
	$VNAME=$ARGV[1];
	$aux=index($URL,"?v=");
	$a = substr $URL,$aux+3,11;
	$content = get($URL);
	@lines = split("\n",$content);
	foreach(@lines) {
		my $aux=index($_,"&t=");
		if ($aux > -1) {
			$t= substr $_, $aux+3,32;
		}
	}
	system "wget -c -O \"$VNAME.flv\" \"http://youtube.com/get_video?video_id=$a&t=$t\"";
	system "ffmpeg -i \"$VNAME.flv\" -ab 128k \"$VNAME.mp3\""; }
print "url2mp3.pl feedback to <albertoi7\@gmail.com>\n\n";

Necesitas WGET y FFMPEG.

Categories: Uncategorized Tags: ,

YouTube to mp3

viernes, 25 de julio de 2008 Albertux Sin comentarios

YouTube to mp3

Aveces queremos tener las canciones de los vídeos en nuestro iPod así que solo agregue unas cuantas lineas al script que hice anteriormente para bajar videos de youtube, el resultado lo pueden apreciar en [youtube_download_mp3.py] es necesario que tengan wget y ffmpeg con lame incluido.

Nota: solo lo e probado con Ubuntu 8.04 pero estoy seguro que funciona bien en Windows.

Categories: Uncategorized Tags: ,