我试图刮zomato网站的评论,但我无法从该网站获得源html代码。我试图获取审阅框,但它返回null或“nonetype”。这是我的密码:
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
from selenium import webdriver
import codecs
import os
import numpy as np
import pandas as pd
# import nltk
# import matplotlib.pyplot as plt
# from tensorflow import keras
os.system('cls')
PATH = "C:\\Users\\HCES\\Downloads\\chromedriver.exe"
driver = webdriver.Chrome(PATH)
i=1
html = driver.get("https://www.zomato.com/beirut/divvy-ashrafieh/reviews?page=
{}&sort=dd&filter=reviews-dd".format(i))
driver.quit()
# soup=BeautifulSoup(html,"lxml")
# tag=soup.find_all('div', class_ = 'sc-esoVGF cHxNXn')
# print(atag)
print(html)
1条答案
按热度按时间atmip9wb1#
你做错了。
您正试图从中返回
driver.get()
但事实应该如此见下文: