iawefhoawiefhoweai
This commit is contained in:
29
autotoot.py
29
autotoot.py
@@ -14,16 +14,29 @@ def run(masto, service):
|
|||||||
service.keep_lively()
|
service.keep_lively()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# get config
|
||||||
|
config = json.load(open('config.json', 'r'))
|
||||||
|
|
||||||
|
# get settings if applicable
|
||||||
|
neuter = False
|
||||||
|
wait = 5
|
||||||
|
try:
|
||||||
|
c = config["autotoot"]
|
||||||
|
if "neuter" in c:
|
||||||
|
neuter = c["neuter"].lower() == "true"
|
||||||
|
if "wait" in c:
|
||||||
|
wait = int(c["wait"])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
print(neuter, wait)
|
||||||
|
# make bots
|
||||||
|
masto = bot(config, neuter=neuter)
|
||||||
|
reddit = scraper("reddit", config, neuter=neuter)
|
||||||
|
|
||||||
|
# run bots forever
|
||||||
while True:
|
while True:
|
||||||
# get config
|
|
||||||
config = json.load(open('config.json', 'r'))
|
|
||||||
# make bots
|
|
||||||
masto = bot(config)
|
|
||||||
reddit = scraper("reddit", config)
|
|
||||||
# run bots
|
|
||||||
run(masto, reddit)
|
run(masto, reddit)
|
||||||
# buffer time bc posts only happen so often so why check
|
time.sleep(wait)
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class reddit_scraper:
|
|||||||
def scrape_all(self, limit):
|
def scrape_all(self, limit):
|
||||||
subposts = {}
|
subposts = {}
|
||||||
for place in self.places:
|
for place in self.places:
|
||||||
|
print(place)
|
||||||
subposts[place] = self.scrape(place, limit)
|
subposts[place] = self.scrape(place, limit)
|
||||||
return subposts
|
return subposts
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user