Loading tools/lemmy_fetcher.py +17 −8 Original line number Diff line number Diff line Loading @@ -61,18 +61,27 @@ def process_post(self, post_body, make_pr = False): print("Post does not contain body: " + str(post_id)) return post_body_main = post_body["body"] if self.is_post_failed(post_id, post_body_main): print("Post already failed with same body: " + str(post_id)) return post_body_main_source = post_body["body"] post_body_main = post_body_main_source.strip() post_json = None if post_body_main.startswith("```json"): post_body_main = post_body_main[7:] if post_body.startswith("```"): post_body = post_body[3:] if post_body_main.endswith("```"): post_body_main = post_body_main[:-3] try: post_json = json.loads(post_body_main) except: print("Post does not contain valid JSON: " + str(post_id)) self.mark_post_as_failed(post_id, post_body_main) if self.is_post_failed(post_id, post_body_main_source): print("Post already failed with same body: " + str(post_id)) return else: self.mark_post_as_failed(post_id, post_body_main_source) self.send_comment(post_id, "An error occurred while parsing this post. Maybe it’s just not a submission, but if it should, then it is not well formatted.") return Loading Loading
tools/lemmy_fetcher.py +17 −8 Original line number Diff line number Diff line Loading @@ -61,18 +61,27 @@ def process_post(self, post_body, make_pr = False): print("Post does not contain body: " + str(post_id)) return post_body_main = post_body["body"] if self.is_post_failed(post_id, post_body_main): print("Post already failed with same body: " + str(post_id)) return post_body_main_source = post_body["body"] post_body_main = post_body_main_source.strip() post_json = None if post_body_main.startswith("```json"): post_body_main = post_body_main[7:] if post_body.startswith("```"): post_body = post_body[3:] if post_body_main.endswith("```"): post_body_main = post_body_main[:-3] try: post_json = json.loads(post_body_main) except: print("Post does not contain valid JSON: " + str(post_id)) self.mark_post_as_failed(post_id, post_body_main) if self.is_post_failed(post_id, post_body_main_source): print("Post already failed with same body: " + str(post_id)) return else: self.mark_post_as_failed(post_id, post_body_main_source) self.send_comment(post_id, "An error occurred while parsing this post. Maybe it’s just not a submission, but if it should, then it is not well formatted.") return Loading