Jun-23-2020, 09:11 AM
I was trying to make a webcrawler to get the years only of a specific page only as practice but it failed
seems fine to me but not have any idea what is wrong
seems fine to me but not have any idea what is wrong
import requests from bs4 import BeautifulSoup def search_year (page_number): url = "https://b-ok.asia/s/Python?page=" + str(page_number) source_code = requests.get(url) plain_text = source_code.text soup = BeautifulSoup(plain_text) for link in soup.findAll("div" , {"class" : "property_value"}): year = link.string print (year) search_year(1)