Advertisement
ZeLib0ba

RU(RF,SU) Expiring domains parser/RU(Рф,SU) парсер освобожда

Mar 28th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. __author__ = 'ZeLib0ba -> http://surin.ru'
  2. # RU(RF,SU) Expiring domains parser
  3. # link from http://auction.nic.ru/forbuyer/download_list.shtml#buying
  4. # you can use another link from this page (etc. http://auction.nic.ru/downloads/su_expiring_list.gz)
  5. # RU(Рф,SU) парсер освобождающихся доменов
  6. # Ссылки со страницы аукциона доменов http://auction.nic.ru/forbuyer/download_list.shtml#buying
  7. # Вы так же можете использовать парсер для других доменов с этой странички.
  8.  
  9. import time
  10. import gzip
  11. import wget
  12. import os
  13. start = time.time()
  14. link = 'http://auction.nic.ru/downloads/ru_expiring_list.gz'
  15. download = wget.filename_from_url(link)
  16. wget.download(link,download)
  17. output = open('ru_expiring_list','wb')
  18. output.write(gzip.open(download,'rb').read())
  19. output.close()
  20. file = "ru_expiring_list"
  21. file_output = "ru_expiring_list.csv"
  22. fo = open(file_output,'w',encoding='utf-8')
  23. f = open(file).readlines()
  24. for i in f:
  25.     a = i.split('\t')
  26.     if len(a)>3:
  27.         output = '%s;%s;%s;%s\n' %(a[0],a[1],a[2],a[3])
  28.         fo.write(output)
  29. fo.close()
  30.  
  31. os.remove(download)
  32. os.remove(file)
  33. print('Done - %s sec.' % str(time.time()-start)[0:4])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement