def get_all_asset_links(zettel_paths): all_Links = Links() # For each zettel. for zettel_path in zettel_paths: # Get the contents of the zettel. with open(zettel_path, 'r', encoding='utf8') as file: contents = file.read() # Get the asset links in the contents and save them # with all the other links in the Links object. links = get_asset_links(contents, zettel_path) all_Links.add(links) return all_Links
log.write('Loading history...') all_history = history.get_history() log.write('Looping through recent comments...') for comment in comments: id = comment.id log.write('Handling comment ' + str(id) + '...') if id not in all_history: log.write('Parsing new comment ' + str(id) + '...') body = comment.body links = LinkExtractor.extract_links(body) if len(links) > 0: for link in links: log.write('Storing new link ' + str(link) + '...') link_file.add(str(link)) log.write('Adding ' + str(link) + ' to history...') history.add(id) else: log.write('No links found in ' + str(id) + '...') else: log.write('Comment seen before...skipping...') log.write('Looping through 10 hottest posts...') for submission in submissions: id = submission.id log.write('Handling post ' + str(id) + '...') if id not in all_history: log.write('Parsing new post ' + str(id) + '...') body = submission.selftext links = LinkExtractor.extract_links(body)