Last active
September 21, 2023 11:30
-
-
Save WillKirkmanM/c5dbdbb50cff66c39721fee8f37943e3 to your computer and use it in GitHub Desktop.
List of Chemistry IA's (From https://www.clastify.com/ia/chemistry) | BeautifulSoup Parsing (Saves to File "IA.txt")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
def main(): | |
page = requests.get("https://www.clastify.com/ia/chemistry", headers={'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'}) | |
soup = BeautifulSoup(page.content, 'html.parser') | |
elements = soup.find_all(class_="MuiTypography-root MuiTypography-subtitle2 css-ydl03f") | |
file = open("IA.txt", "w", encoding="utf-8") | |
for element in elements: | |
file.write(element.text + "\n\n") | |
file.close() | |
for element in elements: | |
print(element.text) | |
print(f"\nFound: {len(elements)} Chemistry IA's") | |
print(f"\nFound: {len(elements)} Chemistry IA's") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment