Download all *.rm files from a site link or and xml link having ram files


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  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??\n')
  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??\n')
  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 ?\n')
  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)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.