<jupyter_start><jupyter_text>First Github ScraperThis notebook is a simplified version of the IRE tutorial “Web scraping with Python.” Consult [the original material](https://github.com/ireapps/teaching-guide-python-scraping) to learn more about how to write a web scraper.<jupyter_code>import requests
import bs4
URL = 'http://www.dllr.state.md.us/employment/warn.shtml'
warn_page = requests.get(URL)
soup = bs4.BeautifulSoup(warn_page.text, 'html.parser')
table = soup.find('table')
rows = table.find_all('tr')
import csv
HEADERS = [
    'warn_date',
    'naics_code',
    'biz',
    'address',
    'wia_code',
    'total_employees',
    'effective_date',
    'type_code'
]
with open('warn-data.csv', 'w', newline='') as outfile:
    writer = csv.writer(outfile)
    writer.writerow(HEADERS)
    for row in rows[1:]:
        cells = row.find_all('td')
        values = [c.text.strip() for c in cells]
        writer.writerow(values)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13692946058091288, 'fraction_numerical': 0.0031120331950207467, 'mean_word_length': 4.105820105820106, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '150127', 'license': 'MIT', 'n_tokens_mistral': 346, 'n_tokens_neox': 332, 'n_words': 77, 'path': 'scrape.ipynb', 'repo_name': 'palewire/first-github-scraper', 'size': '964'}