淘宝商品API可以获取哪些商品详情数据?

164 阅读5分钟

商品详情页

商品全部 sku 信息

「skus」: {
			「sku」: [
				{
					「price」: 45.6,
					「total_price」: 0,
					「orginal_price」: 45.6,
					「properties」: 「1627207:39617249736」,
					「properties_name」: 「1627207:39617249736:颜色分类:【豪华手提桶装】❤100 颗粒随机❤-送 10 公仔+40 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5915706282873」
				},
				{
					「price」: 69.6,
					「total_price」: 0,
					「orginal_price」: 69.6,
					「properties」: 「1627207:39617249737」,
					「properties_name」: 「1627207:39617249737:颜色分类:【豪华手提桶装】❤150 颗粒随机❤-送 15 公仔+45 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065737」
				},
				{
					「price」: 93.6,
					「total_price」: 0,
					「orginal_price」: 93.6,
					「properties」: 「1627207:39617249738」,
					「properties_name」: 「1627207:39617249738:颜色分类:【豪华手提桶装】❤200 颗粒随机❤-送 20 公仔+50 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065738」
				},
				{
					「price」: 117.6,
					「total_price」: 0,
					「orginal_price」: 117.6,
					「properties」: 「1627207:39617249739」,
					「properties_name」: 「1627207:39617249739:颜色分类:【豪华手提桶装】❤250 颗粒随机❤-送 25 公仔+70 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065739」
				},
				{
					「price」: 141.6,
					「total_price」: 0,
					「orginal_price」: 141.6,
					「properties」: 「1627207:39617249740」,
					「properties_name」: 「1627207:39617249740:颜色分类:【豪华手提桶装】❤300 颗粒随机❤-送 30 公仔+75 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065740」
				},
				{
					「price」: 165.6,
					「total_price」: 0,
					「orginal_price」: 165.6,
					「properties」: 「1627207:39617249741」,
					「properties_name」: 「1627207:39617249741:颜色分类:【豪华手提桶装】❤350 颗粒随机❤-送 35 公仔+80 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065741」
				},
				{
					「price」: 189.6,
					「total_price」: 0,
					「orginal_price」: 189.6,
					「properties」: 「1627207:39617249742」,
					「properties_name」: 「1627207:39617249742:颜色分类:【豪华手提桶装】❤400 颗粒随机❤-送 40 公仔+100 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065742」
				},
				{
					「price」: 213.6,
					「total_price」: 0,
					「orginal_price」: 213.6,
					「properties」: 「1627207:39617249743」,
					「properties_name」: 「1627207:39617249743:颜色分类:【豪华手提桶装】❤450 颗粒随机❤-送 45 公仔+105 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065743」
				},
				{
					「price」: 237.6,
					「total_price」: 0,
					「orginal_price」: 237.6,
					「properties」: 「1627207:39617249744」,
					「properties_name」: 「1627207:39617249744:颜色分类:【豪华手提桶装】❤500 颗粒随机❤-送 50 公仔+110 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065744」
				},
				{
					「price」: 261.6,
					「total_price」: 0,
					「orginal_price」: 261.6,
					「properties」: 「1627207:39617249745」,
					「properties_name」: 「1627207:39617249745:颜色分类:【豪华手提桶装】❤550 颗粒随机❤-送 55 公仔+130 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065745」
				},
				{
					「price」: 285.6,
					「total_price」: 0,
					「orginal_price」: 285.6,
					「properties」: 「1627207:39617249746」,
					「properties_name」: 「1627207:39617249746:颜色分类:【豪华手提桶装】❤600 颗粒随机❤-送 60 公仔+135 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065746」
				},
				{
					「price」: 309.6,
					「total_price」: 0,
					「orginal_price」: 309.6,
					「properties」: 「1627207:39617249747」,
					「properties_name」: 「1627207:39617249747:颜色分类:【豪华手提桶装】❤650 颗粒随机❤-送 65 公仔+140 武器+图册」,
					「quantity」: 200,
					「sku_id」: 「5743121065747」
				}
			1
		},

商品标题

「title」: 「我的世界磁力方块全套正版女男孩拼图儿童益智拼装磁铁吸积木玩具」,

商品价格

「price」: 「45.6」,

「orginal_price」: 45.6,

店铺 nick

「nick」: 「奥仑希玩具旗舰店」,

「num」: 「2400」,

商品主图

「pic_url」: 「img.alicdn.com/bao/uploade…」,

品牌

「brand」: 「Auluns/奥仑希 」,

「brandId」: 0,

「rootCatId」: 0,

商品分类

「cid」: 50023652,

商品详情图

「desc」: 「<img src=\」HTTPS://www.o0b.cn/i.PHP?t.png&rid=15.68870c5ef0ab0&p=1941845110&k=19972&t=1753680993\「 style=\」display:none\「 />」,

商品主图

商品属性

淘宝 item_get< a href="o0b.cn/ibrad"> 请求示例

import Java.io.BufferedReader;

import Java.io.IOException;

import Java.io.InputStream;

import Java.io.InputStreamReader;

import Java.io.Reader;

import Java.net.URL;

import Java.nio.charset.Charset;

import org.json.JSONException;

import org.json.JSONObject;

import Java.io.PrintWriter;

import Java.net.URLConnection;

淘宝 item_get 请求示例

public class Example {
	private static String readAll(Reader rd) throws IOException {
		StringBuilder sb = new StringBuilder();
		int cp;
		while ((cp = rd.read()) != -1) {
			sb.append((char) cp);
		}
		return  sb.toString();
	}
	public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
		URL realUrl = new URL(url);
		URLConnection conn = realUrl.openConnection();
		conn.setDoOutput(true);
		conn.setDoInput(true);
		PrintWriter out = new PrintWriter(conn.getOutputStream());
		out.print(body);
		out.flush();
		InputStream instream = conn.getInputStream();
		try {
			BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName(「UTF-8」)));
			String jsonText = readAll(rd);
			JSONObject json = new JSONObject(jsonText);
			return json;
		} finally {
			instream.close();
		}
	}
	public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException {
		URL realUrl = new URL(url);
		URLConnection conn = realUrl.openConnection();
		InputStream instream = conn.getInputStream();
		try {
			BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName(「UTF-8」)));
			String jsonText = readAll(rd);
			JSONObject json = new JSONObject(jsonText);
			return json;
		} finally {
			instream.close();
		}
	}
	public static void main(String[] args) throws IOException, JSONException {
		// 请求示例 url 默认请求参数已经 URL 编码处理
		String url = 「HTTPS://api-gw.onebound.cn/taobao/item_get/?key=<您自己的 apiKey>&secret=<您自己的 apiSecret>&num_iid=652874751412&is_promotion=1;
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}
 
}