#! /usr/bin/python # Script to recursively find places on the web that accept comments. # Written by Peter Lambert (c) 2020, all rights reserved. import time, urllib from os import path # Wether to print as it goes debug = True # Number of addresses to check per site visited max_per_site = 100 # Files for storing data. These can be changed. # Put starting websites in the churn file. # Good results will be placed in the targets file. churn = 'churn.txt' targets = 'targets.txt' pulp = 'pulp.txt' log = 'log.txt' def append_data(logfile, line): ''' Appends a line to a file. ''' with open(logfile, 'a+') as f: f.write(line + '\n') f.close() def load_data(logfile): ''' Loads data from a file as an array of the lines in the file. ''' with open(logfile, 'r') as f: my_array = f.read().split('\n') f.close() return my_array def find_links(s): ''' Returns an array of links found in a string.''' res = [] # Split on the start of a link for t in s.split('