Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Don't know what went wrong
#1
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

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)
Reply


Messages In This Thread
Don't know what went wrong - by Tejas - Jun-23-2020, 09:11 AM
RE: Don't know what went wrong - by nuffink - Jun-23-2020, 11:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Django serving wrong template at the wrong address with malformed urls.py (redactor a Drone4four 2 2,529 Aug-17-2020, 01:09 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020