I'm reading a web-crawling book and imitating it, but it doesn't work when it comes out of the book. An error appears. Please tell me what you mean "T"

Asked 2 years ago, Updated 2 years ago, 22 views

import requests
from bs4 import BeautifulSoup

url = 'http://jolse.com/category/tonermist/43/'
result = requests.get('url')

bs_obj = BeautifulSoup(result.content, 'html.parser')
print(bs_obj)

This is a beginner following the example of crawling a particular site. In the book, crawl on the above overseas shopping mall site is normal, but when I tried it, an error appeared. I don't know if it's because the module isn't installed normally in my environment ㅠ<

-Error contents-

Traceback (most recent call last): File "/Users/haegbonjwa/Library/Preferences/PyCharmCE2018.3/scratches/Crawling traning/4_Jolse_Parsing.py", line 5, in result = requests.get('url') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/api.py", line 75, in get return request('get', url, params=params, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 519, in request prep = self.prepare_request(req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 462, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 313, in prepare self.prepare_url(url, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 387, in prepare_url raise MissingSchema(error) requests.exceptions.MissingSchema: Invalid URL 'url': No schema supplied. Perhaps you meant http://url?

I would appreciate it if you could tell me the reason why the red letters are blocking from the first gate."T" I don't think it's a module problem because the crawling of Naver's real-time search keyword has followed without a problem.

python

2022-09-22 18:01

1 Answers

result = requests.get(url)

You're gonna have to do this. If you look closely, it's probably written like that in the book.


2022-09-22 18:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.