記實一下批量抓取 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)
  5.  
複製代碼


Result
網頁設計 【Python 爬蟲】抓取 Google 搜索結果網頁設計 【Python 爬蟲】抓取 Google 搜索結果


 

 

 

 

接下來設定排程

  1. /usr/bin/python3 /home/xxx/public_html/seo_crawler.py > /dev/null 2>&2

 

網頁設計 【Python 爬蟲】抓取 Google 搜索結果

文章出處



文章來自:
創作者介紹
創作者 苗栗網頁設計 的頭像
willist712v

苗栗網頁設計

willist712v 發表在 痞客邦 留言(0) 人氣( 0 )