urllib.error.HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop. The last 30x error message was: Moved Temporarily
There's an error. Looking at the stack overflow, the above error appears because the page you want to scratch and redirects the cookie when the client does not send it
It's like browser restrictions? I think it will be solved if I solve the same thing, but I don't understand easily because I am a statistics student and I don't know anything about the web or cookies. Is there anyone who can give us a clue to the solution or has experienced a similar error?
python crawling
Can you tell me in detail what page it is?
Please upload the code you used.
def KyungHyang_parse():
#Search page
for j in range(1,2):
url = "http://news.khan.co.kr/kh_news/khan_art_list.html?code=990101&page="
url = url + str(j)
print(j), access the second page. Address :", url)
response = urllib.request.urlopen(url) #There is an error here.
time.sleep(2)
print("sleep for 2 seconds")
soup = BeautifulSoup(response, "html.parser")
article_list = soup.find("div",id = 'news_list')
print(article_list)
That's all the code is this is it. Even if I googled Beautiful Soup redirect avoid, I can't find a sharp answer... The site is the Kyunghyang Shinmun you want to see it.
© 2024 OneMinuteCode. All rights reserved.