Closed fushang318 closed 9 years ago
京东 亚马逊(中国) 凡客 当当 1号店 AliceInMod 易迅 宜家 趣玩 好乐买 NOP 薄荷糯米葱 国美在线 优集品 丽芙家居 无印良品(中国) YOHO!有货 新蛋中国 欧舒丹中国 凡夫
缺少价格获取,这个有思路了,但是实现比较繁琐,先做其他的
天猫多种情况实例 http://markdown.4ye.me/rRYAVhDb
目前已经实现了测试页面,测试页面要求见: https://github.com/mindpin/TouchIdea/issues/26
测试页面访问地址见: https://banana-cake-6494.herokuapp.com/
4 月 9 日调整建议
https://github.com/mindpin/infocard-service 工程建议改名叫: urlinfo-service
同时提供 api 的网址建议改为 urlinfo.4ye.me
针对图片信息,在测试页面上同时显示图片 url 和
把支持的网站列表的每行改成三个链接:
<a href = 'http://www.tmall.com/'>天猫</a>
<a href = '具体商品页链接'>示例商品页</a>
<a href = 'http://markdown.4ye.me/z1eiy6c'>http://markdown.4ye.me/z1eiy6c<a>
程序结构改进
改成支持只传 block 的形式
目前的 JSON 格式设计: https://github.com/mindpin/infocard-service/issues/1
需要修改为
支持的网站,获取特定信息
url
/api/fetch_infocard
method
get
params
url
response
code 200
body 格式
{
:status => "PARSED",
:data => {
image_urls: [
"",
"",
""
],
title: "",
price: ""
}
}
不支持的网站,获取 seo 信息
url
/api/fetch_infocard
method
get
params
url
response
code 200
body 格式
{
:status => "SEO",
:data => {
title: "",
meta: "",
....
}
}
解析错误的网站
url
/api/fetch_infocard
method
get
params
url
response
code 500
body 格式
{
:status => "error"
}
需要准备一个表格,来记录目前 urlinfo.4ye.me 已经支持的网站解析列以及完成情况
表格参考以下格式整理。需要填写的内容是:
淘宝 http://www.taobao.com/ | http://item.taobao.com/item.htm?spm=a217p.7287761.1998186321-0.1.5md6cI&id=39659481806&_scm=1029.list.htm.item.1 |
通过解析网页HTML进行支持 | |
豆瓣电影 http://movie.douban.com/ | http://movie.douban.com/subject/23761370/?from=showing |
通过豆瓣 API 进行解析;图片不能外链 |
https://gitcafe.com/arlyxiao/im-chat-parser-demo
实现过程中一些可以分享的细节 1, oauth 验证流程,参考文档 http://help.jd.com/jos/question-594.html
需要解析 HTML,找到 venderId 字眼分析获取 参考页面 http://item.jd.com/1522032740.html
1, 根据API,获取商品信息,参考文档 http://jos.jd.com/api/detail.htm?apiName=360buy.ware.get&id=108
2, api 调用一些注意点,特别是 sign 生成,参考文档 http://help.jd.com/jos/question-580.html#A6
请参考: http://jos.jd.com/faq/detail.htm?id=142
1, 由于前台是人工浏览器手动登录 需要实践 refreshtoken 在后台自动运行的情况 2, sign 字符串的生成总是有些问题 3, 商家注册, 需要企业营业职照,税务等信息,请参考 http://i.jcloud.com/user/info/certified
1, 在淘宝商品 API 分类目录下根据API名对几类比较有可能有提供价格的进行试验 taobao.products.search 搜索产品信息: http://open.taobao.com/apidoc/api.htm?spm=a219a.7386789.1998342952.2.vLuuBR&path=cid:4-apiId:5
taobao.item.get 得到单个商品信息 http://open.taobao.com/apidoc/api.htm?spm=a219a.7386789.1998342952.8.vLuuBR&path=cid:4-apiId:20
taobao.items.custom.get http://open.taobao.com/apidoc/api.htm?path=cid:4-apiId:163
taobao.items.seller.list.get 批量获取商品详细信息 http://open.taobao.com/apidoc/api.htm?path=cid:4-apiId:24626
2, 搜索 promotion 字眼, http://open.taobao.com//search/searcher.htm?t=api&q=promotion , 或者有 promotion 字眼相关的 API taobao.ump.promotion.get 商品优惠详情查询 http://open.taobao.com/apidoc/api.htm?spm=a219a.7386789.1998342952.38.sTOwPJ&path=cid:4-apiId:11039
3, 发送邮箱咨询: 其他咨询 top#taobao.com
目前没有找到 amazon 有直接提供可以获取商品资料的 API, 但有一个类似的接近的 API, Product Advertising API http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemLookup.html
Product Advertising API 只能获取到 title, 并且是通过 Asin 值来获取
什么是 Asin (item_id), 中文版说明 https://associates.amazon.cn/gp/associates/help/t5/a16?pf_rd_m=A1AJ19PSB66TGU&pf_rd_s=assoc-left-1&pf_rd_r=&pf_rd_t=501&pf_rd_p=&pf_rd_i=assoc_help_main
下面简单介绍下如何使用 Product Advertising API
需要 access key, secret key, associate_tag 才能使用 Amazon Product Advertising API
1, 通过 http://aws.amazon.com/ 申请一个账号, 获取 access key 跟 secret key
2, 通过 https://affiliate-program.amazon.com 获取 associate_tag 值
已经集成到 0.2
infocard-service
写一个 rails 工程,用来解析收集 infocard
版本库地址 https://github.com/mindpin/infocard-service 需求详情 https://github.com/mindpin/TouchIdea/issues/19
infocard 存储模型
解析实现的使用方式如下
下面以实现天猫的商品页解析类举例
所有解析类都要实现 TmallInfocardParser 实现的这些方法
大概的一些实现代码
工作量最大的事情就是,实现各个解析类的 get_hostname get_homepage 这些方法