最近在练习爬虫 想爬104的页面
但无奈遇到页面是由JS render的(拿爱奇艺当范例)
目前code如下:
import requests
from bs4 import BeautifulSoup
url = 'https://www.104.com.tw/company/1a2x6bkonm'
headers = {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/84.0.4147.135 Safari/537.36',
'Referer':
'https://www.104.com.tw/company/1a2x6bkonm'
}
res = requests.get(url, headers=headers)
soup = BeautifulSoup(res.text, 'lxml')
print(soup)
无奈输出后body只有
<div id="globalbar">
<div id="bar_m104">
<div id="global_bk">
剩下全没了
想请问要怎么爬取这种类似网页呢? 谢谢!