(Full beginner) I can't read data when I'm crawling Python web.

Asked 2 years ago, Updated 2 years ago, 69 views

import urllib.request
import bs4

url = "https://sports.media.daum.net/sports/record/epl?tab=playerRank"

html = urllib.request.urlopen(url)

bs_obj = bs4.BeautifulSoup(html, "html.parser")

div = bs_obj.find("div",{"id":"daumWrap"})
div_a = bs_obj.find("div",{"id":"daumContent"})
div_b = bs_obj.find("div",{"id":"cMain"})
div_c = bs_obj.find("div",{"id":"mArticle"})
div_d = bs_obj.find("div",{"class":"wrap_schedule wrap_record"})
div_e = bs_obj.find("div",{"id":"recordWrap"})
div_f = div_d.find("div",{"class":"team_rank team_type2"})

print(div_e)

I'm trying to get the name of the soccer player, but when I keep doing findAll, I make an empty list and do it one by one from the top, but it goes well until div_d, but nothing comes out in the tag from div_e. Please reply.

python crawling

2022-09-22 15:46

1 Answers

When I receive it as a request, I think there is a different value for the tag on the page.

Try selenium


2022-09-22 15:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.