Test Foro de elhacker.net SMF 2.1

Programación => Scripting => Mensaje iniciado por: .:WindHack:. en 23 Abril 2011, 07:22 AM

Título: [Python] SharkTube: ¡Descarga vídeos de YouTube!
Publicado por: .:WindHack:. en 23 Abril 2011, 07:22 AM
(http://i55.tinypic.com/ou8pkh.png)

SharkTube es una utilidad o aplicación gratuita que te permite descargar vídeos de YouTube.
CitarNOTA: Esta utilidad se encuentra registrada en SafeCreative (https://www.safecreative.org/work/1104239044305) bajo la licencia Creative Commons Reconocimiento-NoComercial-CompartirIgual 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode).

Sus características y mejoras son:
Shark.py
Código (python) [Seleccionar]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#   Written by SebastiᮠCastaᯠ(.:WindHack:.)
#             DaW - Labs & Cibernodo
#   - www.daw-labs.com | | www.cibernodo.net  -
#           Version: 1.1 ( Renaissance )
#              Interactive Console
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

import urllib
import re

bLogo = '''
.--. .-.               .-.   .-----.    .-.
: .--': :               : :.-.`-. .-'    : :
`. `. : `-.  .--.  .--. : `'.'  : :.-..-.: `-.  .--.
_`, :: .. :' .; ; : ..': . `.  : :: :; :' .; :' '_.'
`.__.':_;:_;`.__,_;:_;  :_;:_;  :_;`.__.'`.__.'`.__.'
(C) DaW - Labs & Cibernodo.

Welcome!
NOTE: Enter -e or --end to exit the application.
       '''

Char = ['%3A','%2F','%26','%2C','%3D','%252C','%253A','%7C','%3F']
By =   [':','/','&',',','=',',',':','<begin>','?']


def URLDecode(sURL):
   for i in range(len(Char)):
       sURL = sURL.replace(Char[i],By[i])
   return sURL

def CleanData(sData,IsHTML=True):
   if IsHTML == True:
       rReg = re.compile(r'\&.*?;')
   else:
       rReg = re.compile(r',[0-9].?')
   return rReg.sub('',sData)

def GetSourceCode(sURL):
   try:
       URL = urllib.urlopen(sURL)
       sSource = URL.read()
       URL.close()
       return sSource
   except:
       print '[+] Connection error.'
       exit()

def GetIndexVideo(sSource,Tags):
   return sSource.find(Tags)

def GetVideoInformation(sSource):
   sSource = sSource[2000:4500]
   sInfo = []
   #Title...
   sReg = re.findall(r'<meta property="og:title" content="(.+)">',sSource)
   sInfo.append(sReg[0])
   #Shortlink...
   sReg = re.findall(r'<link rel="shortlink" href="(.+)">',sSource)
   sInfo.append(sReg[0])
   #Description...
   sReg = re.findall(r'<meta property="og:description" content="(.+)">',sSource)
   sInfo.append(CleanData(sReg[0]))
   return sInfo

def GetDownloadURL(sSource,sTitle):
   sSource = sSource[10000:18000]
   Begin = GetIndexVideo(sSource,'width="640" id="movie_player" height="390"    flashvars=')+57
   sSource = sSource[Begin:]
   End = GetIndexVideo(sSource,'allowscriptaccess="always" allowfullscreen="true"')+49
   sSource = sSource[:End].split('<begin>')
   lClean = []
   sTitle = '&title='+sTitle.replace(' ','%20')+'%20[SharkTube]'
   for i in sSource:
       if i.startswith('http://v') and len(i) < 400:
           lClean.append(CleanData(i,IsHTML=False)+sTitle)
   return lClean

def __main__():
   print bLogo
   while 1:
       Id = raw_input('Please, enter the YouTube Id. >> ')
       if Id == '-e' or Id == '--end':
           print 'Thank you for using SharkTube. Goodbye'
           exit(1)
       else:
           if len(Id) == 11:
               try:
                   Source = URLDecode(GetSourceCode('http://www.youtube.com/watch?v='+Id))
                   lInfo = GetVideoInformation(Source)
                   URL = GetDownloadURL(Source,lInfo[0])
                   print '''

           -*- Video Information -*-

Title: %s
Shortlink: %s
Description:
%s

Link(s) available(s) to download:
%s

         ''' % (lInfo[0],lInfo[1],lInfo[2],'\n\n'.join(URL))
               except IndexError:
                   print 'Wrong Id. Please, try again...'
           else:
               print 'The ID must be eleven characters. Try again...'

if __name__ == "__main__":
  __main__()


Captura
(http://i51.tinypic.com/a9qq2q.png)

Para usar la versión de Interface Web ( Captura superior ) se debe de descargar el proyecto con todo lo necesario del siguiente enlace: http://db.tt/Jtq2sAA

Más información:
- DaW - Labs | SharkTube: ¡Descarga vídeos de YouTube! (http://daw-labs.com/sharktube-%C2%A1descarga-videos-de-youtube/)
- Cibernodo | SharkTube: ¡Descarga vídeos de YouTube! (http://foro.cibernodo.net/tema-sharktube-%C2%A1descarga-v%C3%ADdeos-de-youtube)

Eso es todo, espero les sea de ayuda y le puedan sacar provecho.
Por último, agradecimiento especial a 5475UK1 por la ayuda en el diseño y creación del logo.




Saludos.,
Título: ¡Descarga vídeos de YouTube!
Publicado por: angrisano en 22 Marzo 2014, 20:35 PM
Hola espero que os sirva a todos los que queráis bajar videos de Youtube.
Hay un programa que es muy sencillo y no tiene ningún problema en descargar los videos, música y todo lo que queráis de Youtube.
Este programa lo estoy usando ni me acuerdo ya. Y a mi siempre me ha ido de maravilla.
Se llama: YTD Video Downloader.
No os puedo mandar el enlace porque en este momento no lo encuentro. Un saludo y hasta pronto.