Nyitsz egy terminált , és
cat > download.py
import os
import urllib2
file2 = urllib2.urlopen("http://www.mssmallbiz.com/ericligman/Key_Shorts/Ligman_eBooks_2017.txt")
with open("redirectlist.txt",'wb') as output:
output.write(file2.read())
with open("redirectlist.txt") as f:
inurls = f.readlines()
for url1 in inurls:
try:
url1 = urllib2.urlopen(url1)
filename = os.path.basename(urllib2.urlparse.urlparse(url1.url).path)
url2 = url1.url
print url2
print filename
file2 = urllib2.urlopen(url2)
with open(filename,'wb') as output:
output.write(file2.read())
except:
pass
utána:
python download.py
[ Szerkesztve ]