| 簡單的範例如下,我們可搭配Python內建的requests和lxml撈到網頁的標題:複製代碼pip install googlesearch-python
我們查個時事的關鍵字"強鹼",列出10個結果,而網頁的標題對新聞的結果具有足夠的資訊量:複製代碼import requests
from lxml.html import fromstring
from googlesearch import search
for result in search("強鹼", num_results=10, lang="zh-tw"):
    print(result)
    r = requests.get(result)
    tree = fromstring(r.content)
    title = tree.findtext('.//title')   
    print(title)
 https://pypi.org/project/googlesearch-python/ https://stackoverflow.com/questions/77762317/python-google-search-not-returning-expected-output
 
 |