記錄一下批量抓取 Google 搜尋結果裡的連結的方法。
如果還沒有安裝以下,要先下載安裝:
cmd
pip install beautifulsoup4 |
Code
python
from googlesearch import search |
Result
解釋
query
: keywords for searchingstop
: Last result to retrieve. UseNone
to keep searching forever.pause
: Lapse to wait between HTTP requests. Lapse too short may cause Google to block your IP. Keeping significant lapse will make your program slow but its safe and better option.