<jupyter_start><jupyter_text>Making list of htmls<jupyter_code>lst = os.listdir("html/")
len(lst)<jupyter_output><empty_output><jupyter_text>Making chunks<jupyter_code>#Splitting list into number of chunks. I need this for the tags in the html code
# Create a function called "chunks" with two arguments, l and n:
def chunks(l, n):
    # For item i in a range that is a length of l,
    for i in range(0, len(l), n):
        # Create an index range for l of n items:
        yield l[i:i+n]<jupyter_output><empty_output><jupyter_text>Visiting each html<jupyter_code>resultlst = []
errors = []

for elem in tqdm(lst):
    #print(elem)
    file = open('html/'+elem, 'r')
    text = file.read()
    html = BeautifulSoup(text, 'html.parser')
    html = html.find_all('td')
    taglist = list(chunks(html, 5))
    for tags in taglist:
        try:
            
            mini_dict = {'ID':tags[0].text,
                     'URL':tags[1].text.split('added')[0],
                     'Date':tags[1].text.split('added')[1],
                     'Valid Phish':tags[3].text}
            resultlst.append(mini_dict)
        except:
            errors.append(elem)<jupyter_output><empty_output><jupyter_text>Making DataFrame<jupyter_code>phishlist = pd.DataFrame(resultlst)
phishlist.info()<jupyter_output><empty_output><jupyter_text>Saving off the files<jupyter_code>phishlist.to_csv('d/goverCERTphishes.csv', index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13236313236313235, 'fraction_numerical': 0.005544005544005544, 'mean_word_length': 3.4705882352941178, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '503818', 'license': 'MIT', 'n_tokens_mistral': 518, 'n_tokens_neox': 505, 'n_words': 107, 'path': '02 Opening HTMLs.ipynb', 'repo_name': 'tamedia-ddj/phishtank', 'size': '1443'}