2021年1月23日星期六

Python WebScaper with BS4 and BeautifulSoup

I am trying to create a webscraper with BS4 that will grab a specific date . I was able to build the webscraper but it is pulling the wrong dates.

The trouble I am running into is that they share the same class, I tried by id but i get a return results of []. How else can I specify this date and not others?

import requests  from bs4 import BeautifulSoup    URL = 'https://nemsis.org/state-data-managers/state-map-v3/colorado'  page = requests.get(URL)    soup = BeautifulSoup(page.content, 'html.parser')    date = soup.find('span',class_='state-updated-on')  date = date.text    print(date)    

and it returns February 16, 2017 but I am looking for 09/04/2019

enter image description here

https://stackoverflow.com/questions/65865918/python-webscaper-with-bs4-and-beautifulsoup January 24, 2021 at 08:13AM

没有评论:

发表评论