Easy Web Scraping With BeautifulSoup and Python | Tutorial

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • Web scraping is really easy to do in Python with Beautiful Soup. Web scraping has many uses including pulling data off of the internet, automating data collection, and much more. BeautifulSoup is a Python tool made specifically for web scraping that is very efficient and easy to use. BeautifulSoup removes the HTML code from a site and strips away the information you want and inserts it into variables with just a few lines of code. We will be teaching you how to use it in this video.
    Please remember to subscribe if you enjoyed this video. Here is the source code used:
    import requests
    from bs4 import BeautifulSoup
    url = 'realpython.git...
    html = requests.get(url)
    s = BeautifulSoup(html.content, 'html.parser')
    results = s.find(id='ResultsContainer')
    job_title = results.find_all('h2', class_='title is-5')
    for job in job_title:
    print(job.text)

Комментарии • 29