記實一下批量抓取 Google 搜索效果裡的貫穿連接的方式。
假如還沒有安裝以下,要先下載安裝:
- pip install beautifulsoup4
- pip install google
複製代碼
Code
- from googlesearch import search
- query = "cambridge"
- for j in search(query, stop=5, pause=2.0):
- print(j)
-
複製代碼
Result
![【Python 爬蟲】抓取 Google 搜索了局的連結 【Python 爬蟲】抓取 Google 搜索了局的連結](https://imageproxy.pixnet.cc/imgproxy?url=https://www.tshopping.com.tw/data/attachment/forum/202204/05/223447gil334yj4a43oa45.png&width=600)
![【Python 爬蟲】抓取 Google 搜索了局的連結 【Python 爬蟲】抓取 Google 搜索了局的連結](https://imageproxy.pixnet.cc/imgproxy?url=https://pic.pimg.tw/netyea/1677078503-1118956475-g_n.png)
接下來設定排程
- /usr/bin/python3 /home/xxx/public_html/搜索引擎優化_crawler.py > /dev/null 2>&2
![【Python 爬蟲】抓取 Google 搜索了局的連結 【Python 爬蟲】抓取 Google 搜索了局的連結](https://imageproxy.pixnet.cc/imgproxy?url=https://pic.pimg.tw/netyea/1677078503-3365822503-g_n.png)
文章出處
來自: