PYTHON 抓去京东,百度的数据
来源:互联网 发布:统计师的python日记 编辑:程序博客网 时间:2024/06/08 18:52
# -*- coding:utf-8 -*-import urllibimport jsonfrom pyquery import PyQueryimport sysreload(sys)sys.setdefaultencoding('utf-8')def get_jd(keyword): doc = PyQuery('https://search.jd.com/Search?keyword='+urllib.quote(keyword)) elements = doc(".gl-i-wrap") for obj in elements: product = {} product["price"] = PyQuery(obj)(".p-price").text() product["name"] = PyQuery(obj)(".p-name").text() product["href"] = PyQuery(obj)(".p-name")("a").attr("href") print str(product).decode('string_escape')def get_baidu(keyword): doc = PyQuery('http://www.baidu.com/s?wd=' + urllib.quote(keyword)) elements = doc(".result") for eme in elements: obj = json.loads(PyQuery(eme)("div")(".c-tools").attr("data-tools")) obj["text"] =PyQuery(eme)(".c-abstract").text() print str(obj).decode('unicode-escape').encode('utf-8')keyword = 'iphone'get_jd(keyword)get_baidu(keyword)
阅读全文
0 0
- PYTHON 抓去京东,百度的数据
- python数据采集百度知道
- 通过python的百度云客户端可以把linux数据备份到百度云
- python爬虫百度贴吧标题数据
- Python爬虫 百度地图搜索数据采集
- Python爬取百度百科页面数据
- Python爬取百度贴吧数据
- python爬虫:从百度贴吧中爬数据
- python处理百度统计csv数据
- 百度编辑器的Python后台
- 使用python爬虫爬取百度手机助手网站中app的数据
- 基于百度API接口的python数据爬虫解析1【笔记】
- 百度人工智能的数据来源
- python 东方财富网&百度股票数据定向爬虫 实例
- python爬虫案例——百度贴吧数据采集
- 百度大数据 CMO的新左脑-百度-喻友平
- Python抓取百度图片搜索的结果
- 百度网盘的 Python 客户端安装
- core-site.xml参数配置详情
- 56 linux内核里声明I2C设备的方法
- js -- 打开新窗口(window.open)、关闭窗口(window.close)
- mapred-site.xml参数配置详情
- JAVA 基础
- PYTHON 抓去京东,百度的数据
- java 获取代理的真实ip
- 命名管道理解与简单C实现
- mySQL存储千万条数据
- Java操作文件输出为字符串以及字符串输出为文件
- python短网址转换
- 玩转Android之数据库框架greenDAO3.0使用指南
- TCP协议详解
- android 一键锁屏