파이썬

beautiful soup user agent

너굴갓 2021. 9. 3. 10:54

from bs4 import BeautifulSoup

import requests

import urllib.request

import urllib.parse

 

url = "크롤링할 사이트 주소"

 

headers = {'User-Agent':'아래 링크에서 얻은 user agent 복붙'}

http://www.useragentstring.com/

 

r = requests.get(url, headers = headers)

soup = BeautifulSoup(r.text, 'html.parser')