jdaher

A858 archive.db Dumper

Apr 29th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.52 KB | None | 0 0
  1. import shelve
  2. import os
  3.  
  4. db = shelve.open('archive.db')
  5. kl = db.keys()
  6. PATH = '/archive/hex/'
  7.  
  8. #users who posted in the sub during open period
  9. users=["imtheswagmaster","oss_spy","team-periwinkle","GrantH527","Kevenomous","VectorAlpha","Dmosk","macho_horse","KAZZZSPIELPLAZZZ","KAZZZSPIELPLAZZZ","7ty7","MurdockSiren","37a6259cc0c1dae299a7","t_the_initial","kamalist","wae55","WishIWasOnACatamaran","jdaher","Twitch89","Llama_7","supahstein","LicensedPrism","magi093","-Orion-","canadianwater","1------6EQUJ5-11--1-","Imabucsfan","62696e617279","bluesci","kaizack","someone31988","SmellyTurbin","lichorat","Toddler_Souffle","oblonglamppost","D748BC45DE589BA8","Am_Alzheimers","nick5627","JiminP","PM_ME_UR_SONICS","LotsOfVodka","bigcakes","42x42","Tasarus","Barvoucher","imtheswagmaster","dreamtreedown","L1maCh4rlie","river58","davidvillar","VoltNine","khaosoffcthulhu","Boo1098","Ramza_Claus","augenwiehimmel","yungodiin","BowsersaurusRex","Kaeny","Stiverton","CreepyMinerLance"]
  10.  
  11.  
  12. print '\n%i records found' %(len(kl))
  13. a = raw_input('Create Archive?  (Y/N) > ')
  14.  
  15. if a == 'y' or a == 'Y':
  16.     print '\nplease wait...'
  17.     if not os.path.exists(PATH):
  18.         os.makedirs(PATH)
  19.  
  20.     ld = os.listdir(PATH)
  21.  
  22.     for i,k in enumerate(kl):
  23.         ext     = '.hex'
  24.         fname   = db[k]['data']['title']+"_"+db[k]['data']['id']+ ext
  25.         text    = db[k]['data']['selftext']
  26.         author  = db[k]['data']['author']
  27.     if author not in users:
  28.             f = open(PATH + fname, 'w+')
  29.             f.write(text)
  30.  
  31.     print 'done...'
Add Comment
Please, Sign In to add comment