ヤフオクAPIを使ってみました。
リクエストパラメータにカテゴリIDを指定する項目があるのですが、カテゴリID検索だと「オークション > コンピュータ > パソコン > Mac > ノートブック、ノートパソコン > MacBook Pro」といったように最下層のカテゴリIDしかわかりません。
ヤフオクAPIでは、「オークション > コンピュータ > パソコン > Mac」といった親カテゴリIDで絞り込んで検索したいこともありますので、親カテゴリIDの調べ方を残しておきます。
この記事の目次
ヤフオクの親カテゴリIDの調べ方
1. 知りたいカテゴリを表示させる
2. URL の xxxxxxxx-category 部分を確認する
URLに含まれる xxxxxxxx-category の xxxxxxxx部分の数字がカテゴリIDです。
ヤフオクAPIを使ってみる
ヤフオクAPI発行
appid(必須)にはあなたのアプリケーションIDを指定してください。
query には ‘mac book air’ と指定しています。
category には 2084039759(コンピュータ > パソコン)を指定しています。
1 |
http://auctions.yahooapis.jp/AuctionWebService/V2/search?appid=<あなたのアプリケーションID>&query=%27mac%20book%20air%27&category=2084039759 |
結果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:jp:auc:search" xsi:schemaLocation="urn:yahoo:jp:auc:search http://auctions.yahooapis.jp/AuctionWebService/V2/search.xsd" totalResultsAvailable="37" totalResultsReturned="20" firstResultPosition="1"> <Result> <Item> <AuctionID>e183712598</AuctionID> <Title>純正/正常動作Macbook Mac Book Air a1370 a1465 クーラーファン</Title> <CategoryId>2084286828</CategoryId> <Seller> <Id>hahang10583</Id> <ItemListUrl> http://auctions.yahooapis.jp/AuctionWebService/V2/sellingList?sellerID=hahang10583 </ItemListUrl> <RatingUrl> http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating?id=hahang10583 </RatingUrl> </Seller> <ItemUrl> http://auctions.yahooapis.jp/AuctionWebService/V2/auctionItem?auctionID=e183712598 </ItemUrl> <AuctionItemUrl> http://page5.auctions.yahoo.co.jp/jp/auction/e183712598 </AuctionItemUrl> <Image width="134" height="89"> http://auctions.c.yimg.jp/images.auctions.yahoo.co.jp/image/dr116/auc0211/users/1/3/4/1/hahang10583-thumb-1410367267158073.jpg </Image> <OriginalImageNum>1</OriginalImageNum> <CurrentPrice>1200.00</CurrentPrice> <Bids>0</Bids> <EndTime>2017-01-18T21:30:19+09:00</EndTime> <BidOrBuy>1400.00</BidOrBuy> <IsReserved>false</IsReserved> <CharityOption> <Proportion>0</Proportion> </CharityOption> <Option> <FeaturedIcon> http://image.auctions.yahoo.co.jp/images/featured.gif </FeaturedIcon> <BuynowIcon> http://image.auctions.yahoo.co.jp/images/buynow.gif </BuynowIcon> <EasyPaymentIcon>http://i.yimg.jp/images/pay/icon_s16.gif</EasyPaymentIcon> <IsBold>true</IsBold> <IsBackGroundColor>false</IsBackGroundColor> <IsOffer>false</IsOffer> <IsCharity>false</IsCharity> </Option> <IsAdult>false</IsAdult> </Item> <Item>...</Item> <Item>...</Item> <Item>...</Item> 中略 <Item>...</Item> </Result> </ResultSet> |
カテゴリIDで絞り込んで検索できました。