<jupyter_start><jupyter_text>Intro to Web Scraping<jupyter_code># Imports
from requests import get
import pandas as pd
from bs4 import BeautifulSoup<jupyter_output><empty_output><jupyter_text>Web Scraping == Reading and Parsing Data- TXT- JSON - CSV- **HTML** (The language of content and structure for the web)<jupyter_code># URLS 
text_url = 'https://machinelearning.fit/example.txt'
json_url = 'https://machinelearning.fit/example.json'
csv_url = 'https://machinelearning.fit/example.csv'
html_url = 'https://machinelearning.fit/example.html'
reponse = get(html_url)
response.text
soup = BeautifulSoup(response.text)
soup.text
soup.find("a")
soup.find("a")["href"]
soup.find("h1").text
soup.find_all("h2")[-1].text<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14190093708165996, 'fraction_numerical': 0.00535475234270415, 'mean_word_length': 6.711340206185567, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '479838', 'license': 'MIT', 'n_tokens_mistral': 273, 'n_tokens_neox': 268, 'n_words': 54, 'path': 'scraping-intro.ipynb', 'repo_name': 'ryanorsinger/machinelearning.fit', 'size': '747'}