ttyb / baiduindex Goto Github PK
View Code? Open in Web Editor NEW百度指数-图像识别抓取,逻辑不难,代码写得渣渣
百度指数-图像识别抓取,逻辑不难,代码写得渣渣
悬浮窗口无法显示 firefox和谷歌浏览器都试了
截图中没有悬浮窗的信息。
希望大神能帮忙解决一下
我把输入的js信息改成了如下的xi形式:
days = "-".join(str(day).split(","))
params = {'time':days,'word':keyword}
querystring = urlencode(params)
print (querystring)
url = 'http://index.baidu.com/?tpl=trend&type=0&area=0&'+querystring
url.replace("-","%7C")
print(url)
js = 'window.open("'+url+'");'
browser.execute_script(js)
在模拟的浏览器上就成了:(图片上传不了),就是在地址栏里面word后面是中文,而不是urlencode后的字符,而且在输入框里面的是乱码。
请问:有什么比较不麻烦的时间选择特定时间获取数据的方式么,操作选择框,填充时间这个我没有尝试成功。
当某些关键字的百度指数为0 的时候,识别不了诶。这个怎么解决呢?
while True:
try:
xoyelement = self.driver.find_elements_by_css_selector("#trend rect")[2]
break
except NoSuchElementException as e:
print (e.message)
except IndexError:
pass
print ("提取图片信息")
for i in range(Time_difference+1):
x = i*(MAX_WIDTH/Time_difference)
y = 10
ActionChains(self.driver).move_to_element_with_offset(xoyelement, x, y).perform()
这是我的代码 按照你的代码 选取trend rect 的下标为2的 但是并没有弹出对应数据导致后面这句话报错
这里的x y 的值我可以确定是没问题的
imgelement = self.driver.find_element_by_xpath('//div[@id="viewbox"]')
不知道你有没有遇到过
是不是因为登录百度时候优先出现二维码,所以报错了。
selenium.common.exceptions.InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated
(Session info: chrome=63.0.3239.108)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.10586 x86_64)
获取指数位置,发现有些对的上,有些对不上。我发现它的位置和曲线上点的相对位置并不是固定滴。请问大神你是怎么解决的。
进入指数页面 完成点击搜索,弹出登陆框,这个你没有出现嘛?谢啦
鼠标自动移动的时候,没有截取到指数数值的图。 看起来图的定位不正确。
用的Chrome Driver 2.32.498537版本。
Chrome: Version 60.0.3112.113 (Official Build) (64-bit)。
Python 3.6
如题,比如取一个关键词的90天指数,也就是登陆+截90张图+分析需要多久? ^_^ 谢谢了老哥!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.