baixador em python [RESOLVIDO]

1. baixador em python [RESOLVIDO]

felipe
phellipe_

(usa Slackware)

Enviado em 23/10/2018 - 13:14h

oi!
estou programando um script que faz download em massa, mas não estou conseguindo

#!/usr/bin/env python
#-*-coding: utf-8;-*-
import urllib
print "||========================================================||"
print "||########################################################||"
print "||# Automatic Linux Get v1.5 by: phellipe_ #||"
print "||########################################################||"
print "||========================================================||"
link = raw_input("links: ")
name = raw_input("Names: ")
print "Downloading files..."
with open(link, "r") as l:
with open(name, "r") as n:
for on in l.readlines():
print "%s" %on
with open(on, "wb") as w:
for ol in l.readlines():
arq = urllib.urlopen(ol)
w.write(arq.read())
print "File OK"

agradeço a quem puder me ajudar!


  


2. Re: baixador em python

felipe
phellipe_

(usa Slackware)

Enviado em 23/10/2018 - 14:21h

phellipe_ escreveu:

oi!
estou programando um script que faz download em massa, mas não estou conseguindo

#!/usr/bin/env python
#-*-coding: utf-8;-*-
import urllib
print "||========================================================||"
print "||########################################################||"
print "||# Automatic Linux Get v1.5 by: phellipe_ #||"
print "||########################################################||"
print "||========================================================||"
link = raw_input("links: ")
name = raw_input("Names: ")
print "Downloading files..."
with open(link, "r") as l:
with open(name, "r") as n:
for on in l.readlines():
print "%s" %on
with open(on, "wb") as w:
for ol in l.readlines():
arq = urllib.urlopen(ol)
w.write(arq.read())
print "File OK"

agradeço a quem puder me ajudar!


atualizei o codigo, ele baixa mas corrompe o arquivo

#!/usr/bin/env python
#-*-coding: utf-8;-*-
import urllib
print "||========================================================||"
print "||########################################################||"
print "||# Automatic Linux Get v2.0 by: phellipe_ #||"
print "||########################################################||"
print "||========================================================||"
link = raw_input("Links txt: ")
name = raw_input("Names txt: ")
print "Downloading files..."
with open(name, "r") as n:
with open(link, "r") as l:
for ol in l.readlines():
print ol.rstrip()
print "OK"
for on in n.readlines():
with open(on.rstrip(), "wb") as w:
w.write(ol.rstrip())
print "Files ok"



3. Re: baixador em python [RESOLVIDO]

felipe
phellipe_

(usa Slackware)

Enviado em 23/10/2018 - 14:46h

ja descobri!!!
esqueci o urllib!


4. Re: baixador em python [RESOLVIDO]

Lisandro Guerra
Lisandro

(usa Arch Linux)

Enviado em 31/10/2018 - 21:15h

Poste o código que funcionou. Pode ajudar outra pessoa.
;-D






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts