diff --git a/pseudbot/bot.py b/pseudbot/bot.py index 7b11c30..ffc4692 100644 --- a/pseudbot/bot.py +++ b/pseudbot/bot.py @@ -114,7 +114,7 @@ class PseudBot: ) sleep(901) - jdump(tweets_j) + jdump(tweets_j, extra_tag=self.target_screen_name) def timeline(self): """ @@ -125,7 +125,7 @@ class PseudBot: for tweet in home_tl: jsons.append(tweet._json) - jdump(jsons, echo=True) + jdump(jsons, extra_tag=self.screen_name) def _tweet_pasta(self, id_reply_to: int, pasta: [str]): """ @@ -209,7 +209,7 @@ class PseudBot: log_t_by_sname(tweet) jtweets.append(tweet._json) - jdump(jtweets) + jdump(jtweets, extra_tag=self.last_id) def pasta_tweet(self): """ diff --git a/pseudbot/util.py b/pseudbot/util.py index 9b37a86..8d579e6 100644 --- a/pseudbot/util.py +++ b/pseudbot/util.py @@ -12,8 +12,13 @@ def surl_prefix(screen_name: str): return "https://twitter.com/" + screen_name + "/status/" -def jdump(itms, echo: bool = False): - dfname = str(inspect.stack()[1][3]) + "." + str(int(time())) + ".dump.json" +def jdump(itms, echo: bool = False, extra_tag: str = None): + tag = "." + if extra_tag is not None: + tag = "." + str(extra_tag) + "." + + dfname = str(inspect.stack()[1][3]) + tag + str(int(time())) + ".dump.json" + print('[INFO]: Writing JSON dump to "{}"'.format(dfname)) df = open(dfname, mode="w") pretty = j.dumps(itms, sort_keys=True, indent=2)