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) 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('Post seen before...skipping...') else: log.write('Failed to get subreddit...') log.write('This is most likely due to Reddit\'s request limitations...') log.write('Will try again momentarily...') history.close() log.close() link_file.close()