从站点链接或包含ram文件的xml链接下载所有*.rm文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从站点链接或包含ram文件的xml链接下载所有*.rm文件相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env python # # best.py # # Copyright 2008 hemanth <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. import commands import os import pickle def readDir(): directory = raw_input('In which folder would you like to save the songs?? ') if(os.path.exists(directory)): print 'Error!! Please give an other name ' directory = raw_input('In which folder would you like to save the songs?? ') os.mkdir(directory) os.chdir(directory) else: os.mkdir(directory) os.chdir(directory) readDir() url = raw_input('Which url are you aiming at ? ') tmp = open('tempo.txt','w'); tmp.writelines(url) tmp.close() tmp = open('tempo.txt','r'); link = tmp.read() os.system(" curl " + link +"| egrep -o 'http:.*All.ram' > final.txt ") infile =open('final.txt', 'r') outfile = open('tmp.txt', 'w') for line in infile: outfile = open('tmp.txt', 'w') key = line list = key.split("/") dir = list[6] outfile.writelines(key) outfile.close() open('tmp.txt','r') os.system("cat tmp.txt | xargs -n1 -i curl {} > links") os.system("wget -P %s -i links" %dir) infile.close() outfile.close() os.remove(outfile.name) os.remove('links') os.remove(tmp.name)
以上是关于从站点链接或包含ram文件的xml链接下载所有*.rm文件的主要内容,如果未能解决你的问题,请参考以下文章