2 Star 7 Fork 1

sent/python基于Selenium框架爬取美团酒店数据

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
getromid.py 508 Bytes
一键复制 编辑 原始数据 按行查看 历史
sent 提交于 6年前 . python代码
from selenium import webdriver
import selenium
from selenium.webdriver.chrome.options import Options
#获取到酒店的id,返回0就是传入的参数有错误
def getroomid(bris,city,HotelName):
url1="https://i.meituan.com/s/%s-%s?cid=20&cateType=poi"%(city,HotelName)
print(url1)
bris.get(url1)
try:
HotelId=bris.find_element_by_xpath('//*[@id="deals"]/dl/dd[1]/dl[1]/dd/a').get_attribute("href")
return HotelId.split("/")[4]
except:
return 0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/the_sent/selenium.git
git@gitee.com:the_sent/selenium.git
the_sent
selenium
python基于Selenium框架爬取美团酒店数据
master

搜索帮助