twitools/followertxt.py

21 lines
503 B
Python
Raw Normal View History

#!/usr/bin/env python3
import twitools, setuptools
2015-05-18 11:05:14 +00:00
import os, time, tweepy
2015-05-18 11:05:14 +00:00
def getOutDir(dirname="followers"):
if not os.path.isdir(dirname):
os.mkdir(dirname)
2015-05-18 11:05:14 +00:00
def getOutFile(dirname="followers"):
getOutDir(dirname)
return os.path.join(dirname, str(int(time.time())) + ".txt")
def writeOutFile(outfile=getOutFile()):
with open(getOutFile(), 'a') as f:
for follower in twitools.getNamesByIDs(twitools.getFollowerIDs()):
2015-05-18 11:05:14 +00:00
f.write(follower + "\n")
if __name__ == "__main__":
writeOutFile()