TShopping

 找回密碼
 註冊
搜索
查看: 1339|回復: 0
打印 上一主題 下一主題

[教學] 【Python 爬蟲】抓取 Google 搜尋結果的連結

[複製鏈接]
跳轉到指定樓層
1#
發表於 2022-4-5 22:35:36 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
記錄一下批量抓取 Google 搜尋結果裡的連結的方法。


如果還沒有安裝以下,要先下載安裝:

  1. pip install beautifulsoup4
  2. pip install google
複製代碼

Code
  1. from googlesearch import search
  2. query = "cambridge"
  3. for j in search(query, stop=5, pause=2.0):
  4.         print(j)
複製代碼

Result



接下來設定排程
  1. /usr/bin/python3 /home/xxx/public_html/seo_crawler.py > /dev/null 2>&2
複製代碼




文章出處




 

臉書網友討論
*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-4-25 17:28 , Processed in 0.092163 second(s), 25 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表