Hello Hello GIS辣妹来了,今天分享google map地点的评论抓取方法,抓取的评论可以用做NLP情感分析!
一、数据准备
我的网站数据表格如下,就是一个存储网站链接的,但是网站必须要是图2里面,一个location,左边就是这个location的review(因为我代码就是爬这个review,所以里面的容器是固定的,避免出错还是按照我这个弄)
二、代码部分
下面就是代码部分,记得装相应的包以及更改自己的网站表格存储路径。
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
import pandas as pd
import time
# 使用webdriver-manager自动安装和配置ChromeDriver
service = Service(ChromeDriverManager().install())