elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Python] Script que descarga un MP3 de GOEAR
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Python] Script que descarga un MP3 de GOEAR  (Leído 2,194 veces)
Kasswed
Colaborador
***
Desconectado Desconectado

Mensajes: 5.295

Rolling Stones


Ver Perfil
[Python] Script que descarga un MP3 de GOEAR
« en: 19 Agosto 2008, 19:54 pm »

Modo de uso:

Código:
python script.py <url1> <url2> <url3> ...

Ejemplo:

Código:
python script.py http://goear.com/listen.php?v=e470c04

En principio lo he hecho para Linux, no sé si en Windows se podrá usar, supongo que instalando wget (que no sé si lo trae por defecto) debería ir sin problemas.


Código
  1. #!/usr/bin/env python
  2.  
  3. import os
  4. import sys
  5. import string
  6. import commands
  7.  
  8. Debug = 0
  9. i=1
  10.  
  11. while i < (len(sys.argv)):
  12.  
  13. print i
  14.  
  15. print sys.argv[i]
  16.  
  17. print "\n\n\n"
  18.  
  19. try:
  20. http = sys.argv[i]
  21. except:
  22. http = raw_input("Put the original http:")
  23.  
  24. xmlfile = string.replace(http, "listen.php?v=", "files/sst/secm")
  25. xmlfile = xmlfile + ".xml"
  26.  
  27. command = "wget " + xmlfile + " -O file.xml"
  28.  
  29. result = commands.getstatusoutput(command)
  30.  
  31. if Debug > 1:
  32. print result
  33.  
  34. f = open("file.xml","U")
  35. fichero = f.read()
  36. ini = string.find(fichero,"http://")
  37. fin = string.find(fichero,"mp3") + 3
  38. url = fichero[ini:fin]
  39.  
  40.  
  41. artistIni = string.find(fichero,"artist=\"") + 8
  42. artistFin = string.find(fichero,"title=") - 2
  43.  
  44. artist = fichero[artistIni:artistFin]
  45.  
  46. titleIni = string.find(fichero,"title=\"") + 7
  47. titleFin = string.find(fichero,"\"/>") - 1
  48.  
  49. title = fichero[titleIni:titleFin]
  50.  
  51.  
  52. command = "wget " + url + " -O \"" + artist + " - " + title + ".mp3\""
  53.  
  54. os.system(command)
  55.  
  56. try:
  57. os.system("rm file.xml")
  58. except:
  59. os.system("del file.xml")
  60.  
  61. f.close()
  62. i = i+1
  63.  


« Última modificación: 19 Agosto 2008, 20:21 pm por Cab Calloway » En línea

"He who allows himself to be insulted, deserves to be."

Repórtame cualquier falta a las normas del foro por mensaje privado.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Python] SharkTube: ¡Descarga vídeos de YouTube!
Scripting
.:WindHack:. 1 3,172 Último mensaje 22 Marzo 2014, 20:35 pm
por angrisano
Recomendaciones, sugerencias script python
Scripting
Arnau27 1 3,336 Último mensaje 8 Septiembre 2011, 01:28 am
por S3kh
[Python] Little Script Codepad
Scripting
The Swash 0 2,081 Último mensaje 2 Noviembre 2011, 03:35 am
por The Swash
Ayuda con script python
Scripting
Xenomorfo77 5 3,723 Último mensaje 4 Mayo 2012, 02:13 am
por Xenomorfo77
Script en Python [Duda]
Scripting
michelmarques 2 2,223 Último mensaje 14 Julio 2012, 22:39 pm
por michelmarques
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines