def summarizeSMRZR(url): """get post information and summary using Smrzr. Format properly.""" summ_article = smrzr.Summarizer(url, 4, 'default', 'newspaper') keypoints = summ_article.keypoints summ = summ_article.summary message = "\n\n> * ".join(keypoints) message = "> * " + message message = message.replace("`", "") message = message.replace("#", "\#") return summ, message, summ_article.text
def prepare(submission): link = submission.url summ_article = smrzr.Summarizer(link) keypoints = summ_article.keypoints summ = summ_article.summary message = "\n\n> * ".join(keypoints) message = "> * " + message message = message.replace("`", "") message = message.replace("#", "\#") # Find relevant links using google relevant_list = find_other_news_sources.find_other_news_sources(url=link)
try: forest_comments = submission.comments except Exception as e: continue for comment in forest_comments: if str(comment.author) == 'samacharbot2': visited = True # skip post if posted already if visited == True: continue # get post information and summary using Smrzr. Format properly. link = submission.url summ_article = smrzr.Summarizer(link) keypoints = summ_article.keypoints summ = summ_article.summary message = "\n\n> * ".join(keypoints) message = "> * " + message message = message.replace("`", "") message = message.replace("#", "\#") # Find relevant links using google relevant_list = find_other_news_sources.find_other_news_sources( url=link) # check if its null or doesnt contain anything. if relevant_list is None or len(relevant_list) == 0: if len(message) > 100: try: