There is no error in python3 crawling, but html does not appear

Asked 2 years ago, Updated 2 years ago, 110 views

import requests
from bs4 import BeautifulSoup

url = "https://upbit.com/service_center/notice"
result = requests.get(url =url)
bs_obj = BeautifulSoup(result.content, "html.parser")

print(bs_obj)

There is no error when entering the code at the top, but HTml does not come out It doesn't even crawl. I think the site itself has prevented this kind of crawling <

<Problem Output>

In this case, how do I make the crawling code? I'm a beginner. Help me.

python beautifulsoup

2022-09-21 21:33

1 Answers

It's coming out right.

print(bs_obj.text)

You'll know when you try it, but you can't see the screen when you first go into Upbeat I'm capturing the page, and I'm showing it. In the first place, bs4 is like a screenshot that only requests web pages from the server, receives HTML, and shows us.

If the questioner says "strong", please waitIf you're trying to crawl the upbeat main page after ...

Try curling using selenium.

import requests
import time
import urllib
from selenium import webdriver
from bs4 import BeautifulSoup

#Browser Settings
binary=FirefoxBinary('C:/Program Files/Mozilla Firefox/firefox.exe')
browser=webdriver.Firefox(executable_path='C:/Program Files/Mozilla Firefox/geckodriver.exe',firefox_binary=binary)

url = "https://upbit.com/service_center/notice"
browser.get(url)
time.sleep(10)
html = browser.page_source
soup=BeautifulSoup(html, 'html.parser')
print(soup.text)


2022-09-21 21:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.