从站点链接或包含ram文件的xml链接下载所有*.rm文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从站点链接或包含ram文件的xml链接下载所有*.rm文件相关的知识,希望对你有一定的参考价值。

  1. #!/usr/bin/env python
  2. #
  3. # best.py
  4. #
  5. # Copyright 2008 hemanth <[email protected]>
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  20. # MA 02110-1301, USA.
  21.  
  22.  
  23.  
  24.  
  25. import commands
  26. import os
  27. import pickle
  28.  
  29. def readDir():
  30. directory = raw_input('In which folder would you like to save the songs?? ')
  31. if(os.path.exists(directory)):
  32. print 'Error!! Please give an other name '
  33. directory = raw_input('In which folder would you like to save the songs?? ')
  34. os.mkdir(directory)
  35. os.chdir(directory)
  36. else:
  37. os.mkdir(directory)
  38. os.chdir(directory)
  39.  
  40.  
  41. readDir()
  42. url = raw_input('Which url are you aiming at ? ')
  43. tmp = open('tempo.txt','w');
  44. tmp.writelines(url)
  45. tmp.close()
  46. tmp = open('tempo.txt','r');
  47. link = tmp.read()
  48. os.system(" curl " + link +"| egrep -o 'http:.*All.ram' > final.txt ")
  49.  
  50.  
  51.  
  52. infile =open('final.txt', 'r')
  53. outfile = open('tmp.txt', 'w')
  54.  
  55.  
  56.  
  57. for line in infile:
  58.  
  59. outfile = open('tmp.txt', 'w')
  60. key = line
  61. list = key.split("/")
  62. dir = list[6]
  63. outfile.writelines(key)
  64. outfile.close()
  65. open('tmp.txt','r')
  66. os.system("cat tmp.txt | xargs -n1 -i curl {} > links")
  67. os.system("wget -P %s -i links" %dir)
  68.  
  69. infile.close()
  70. outfile.close()
  71. os.remove(outfile.name)
  72. os.remove('links')
  73. os.remove(tmp.name)

以上是关于从站点链接或包含ram文件的xml链接下载所有*.rm文件的主要内容,如果未能解决你的问题,请参考以下文章

防止从我使用 PHP 以外的站点直接下载链接下载

javaweb jsp页面上点击链接下载文件 IE浏览器弹出“已经阻止从站点下载文件到您的计算机”

Scrapy抓取所有站点地图链接

用wget做站点镜像

使用链接下载 Revit 模型

用wget做站点镜像