【学习交流】python简易爬虫入门

正常访问能打开吗?900 说明网站那边识别了你是爬虫,所以把你屏蔽了,只返回空内容给你。原因很多,如果 IP 地址没被屏蔽,可以伪装的更像一点,可以使用 Python 操作浏览器去爬取网站内容,但需要进一步学习 Python 的基础知识。

pip install playwright
playwright install
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto("https://zidian.911cha.com/zi7684.html")
    print(page.content())
    browser.close()

https://playwright.dev/python/docs/intro/

2 个赞