Código
#!/usr/bin/python # -*- coding: utf-8 -*- # VideoDown.py - DaW - Labs # Autor: .:WindHack:. # 22/07/2010 - www.daw-labs.com # Puede usar, modificar y redistribuir este codigo # siempre y cuando respete los derechos de autor. import sys, urllib from sgmllib import SGMLParser class Parser(SGMLParser): def reset(self): SGMLParser.reset(self) self.urls = [] def start_a(self, attrs): href = [v for k, v in attrs if k=='href'] if href: self.urls.extend(href) def DownloadStatus(Bloque,Tamano,Total): Cantidad = Bloque * Tamano / 1024 Total = Total / 1024 print 'Cantidad descargada: %s KB de %s KB ...' % (Cantidad,Total) if Cantidad > Total: print 'Descarga finalizada.' def DownloadVideo(URL, Name, Status): try: Download = urllib.urlretrieve(URL, Name, Status) return Download[0] except: return 'Ha sucedido un error en la descarga.' def GetDownloadURL(URL,Download): if len(URL) != 0: URLv = urllib.urlopen('http://www.flashvideodownloader.org/download2.php?u=%s' % URL) DownloadURL = Parser() DownloadURL.feed(URLv.read()) DownloadURL.close() URLv.close() URL = DownloadURL.urls[8] if Download == True: DownloadVideo(URL,'C:\Video_By_VideoDown.flv',DownloadStatus) else: return 'La URL de descarga es:\n%s' % URL else: return 'URL invalida...' def __main__(): __Ayuda__ = ''' _ _ _ _ ___ _ | | |<_> _| | ___ ___ | . \ ___ _ _ _ ._ _ | | | ' || |/ . |/ ._>/ . \| | |/ . \| | | || ' ||_/ |__/ |_|\___|\___.\___/|___/\___/|__/_/ |_|_|<_> © 2010. DaW - Labs - www.daw-labs.com Uso: VideoDown.py <OPCION> <URL> Opciones: -D : Descarga un video. -O : Obtiene solo la URL de descarga. -H : Muestra la ayuda. ----------------------------------------------------------- Para ver la lista de sitios soportados abra el archivo: Supported Sites.txt ''' try: Opc = sys.argv[1] if Opc == '-H': print __Ayuda__ elif Opc == '-D': GetDownloadURL(sys.argv[2],True) elif Opc == '-O': print GetDownloadURL(sys.argv[2],False) else: print 'Se esperaba un parametro...' except: print __Ayuda__ if __name__ == "__main__": __main__()
Más Información: http://daw-labs.com/videodown-descarga-videos-de-metacafe-dailymotion-y-muchos-sitios-mas/
P.D.: No puedo poner tildes, el GeShi me las modifica.