首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用来自R的接口搜索eBay

使用来自R的接口搜索eBay
EN

Stack Overflow用户
提问于 2016-01-05 23:50:34
回答 2查看 1.4K关注 0票数 2

我正在尝试使用R在站点的API上使用eBay进行搜索。然而,我完全不知所措,不知该如何做。

我熟悉在R中使用其他API,例如Twitter和Instagram。其中一些搜索可以使用专用库(twitteR、streamR等)进行,但我也不得不用httr和RCurl拼凑起来。不幸的是,我在ebay上对这样的方法一点运气都没有。我试过了:

代码语言:javascript
复制
getURL(''http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords
           &SERVICE-VERSION=1.0.0
           &SECURITY-APPNAME=My_App_ID
           &GLOBAL-ID=EBAY-US
           &RESPONSE-DATA-FORMAT=JSON
           &callback=_cb_findItemsByKeywords
           &REST-PAYLOAD
           &keywords=harry%20potter
           &paginationInput.entriesPerPage=3')

它没有起作用。我也试过了:

代码语言:javascript
复制
 url <- "http://svcs.ebay.com/services/search/FindingService/v1"
 xml.request <- "<?OPERATION-NAME=findItemsByKeywords
 &SERVICE-VERSION=1.0.0
 &SECURITY-APPNAME=My_App_ID
 &GLOBAL-ID=EBAY-US
 &RESPONSE-DATA-FORMAT=XML
 &callback=_cb_findItemsByKeywords
 &REST-PAYLOAD
 &keywords=harry%20potter
 &paginationInput.entriesPerPage=3>"

 myheader=c(Connection="close", 
 'Content-Type' = "application/xml",
 'Content-length' =nchar(xml.request))

  data =  getURL(url = url,
           postfields=xml.request,
           httpheader=myheader,
           verbose=TRUE)

这个也不走运。基本上,我不知道我在做什么。有人能帮上忙吗?

EN

回答 2

Stack Overflow用户

发布于 2017-12-20 12:37:36

我已经用一个新的名为ebayr的R包包装了ebay的with API,它带有一个httr::GET调用。查看此处:https://github.com/gsimchoni/ebayr

您需要从https://go.developer.ebay.com/获取令牌,然后就可以使用了。

这里也有一篇博客文章来寻找灵感:http://giorasimchoni.com/2017/12/19/2017-12-19-e-is-for-elephant-the-ebayr-package/

票数 1
EN

Stack Overflow用户

发布于 2016-12-06 02:52:39

代码语言:javascript
复制
url <- 'http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=USER_ADD_ID&GLOBAL-ID=EBAY-US&keywords=macbook+refurbished&paginationInput.entriesPerPage=10'

getURL(url)

> getURL(url)
[1] "<?xml version='1.0' encoding='UTF-8'?><findItemsByKeywordsResponse xmlns=\"http://www.ebay.com/marketplace/search/v1/services\"><ack>Success</ack><version>1.13.0</version><timestamp>2016-12-05T18:48:43.170Z</timestamp><searchResult count=\"10\"><item><itemId>152233530373</itemId><title>Apple Macbook Air 11.6\" 1.3 GHz Core i5 128 GB SSD, 4GB RAM, Yosemite- MD711LL/A</title><globalId>EBAY-US</globalId><subtitle>OS Upgraded to 10.10 Yosemite l Cosmetic Condition 8/10</subtitle><primaryCategory><categoryId>111422</categoryId><categoryName>Apple Laptops</categoryName></primaryCategory><galleryURL>http://thumbs2.ebaystatic.com/m/mpUZSSnEfwJ5YOFJ8JzcmXw/140.jpg</galleryURL><viewItemURL>http://www.ebay.com/itm/Apple-Macbook-Air-11-6-1-3-GHz-Core-i5-128-GB-SSD-4GB-RAM-Yosemite-MD711LL-A-/152233530373</viewItemURL><productId type=\"ReferenceID\">160128184</productId><paymentMethod>PayPal</paymentMethod><autoPay>true</autoPay><location>USA</location><country>US</country><shippingInfo><shipp... <truncated>

参考Getting Started with the Finding API: Finding Items by Keywords

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34615760

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档