抖店获取商品详情 Python php java jason

随着移动互联网的迅猛发展,短视频平台如抖音已经成为人们日常生活的重要组成部分。在这个信息爆炸的时代,如何快速、准确地获取商品信息,并将其精准地推送给目标用户,成为了商家们关注的焦点。抖音商品详情接口应运而生,为商家们提供了一个全新的智能营销解决方案。 item_get_app-获取商品详情源数据

获取示例key和秘钥免费测试

Java请求示例代码

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;

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/douyin/item_get_app/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=3514453298386183303";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

返回示例参数

{
    "item": {
        "activity_end_time": "",
        "activity_start_time": "",
        "category_id": 4,
        "category_name": "服饰内衣",
        "comment_num": 63807,
        "comment_score": 4.1,
        "cos_fee": 299,
        "cos_ratio": 15,
        "coupon_price": 1990,
        "cover": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_ffbe4b9c7cbfa4628cc4a07841264945_sx_157941_www800-800",
        "create_time": "",
        "daily_statistics": [
            {
                "date": "20240228",
                "kol_num": 53,
                "order_num": 250,
                "view_num": 3084
            },
            {
                "date": "20240229",
                "kol_num": 52,
                "order_num": 250,
                "view_num": 2540
            },
            {
                "date": "20240301",
                "kol_num": 58,
                "order_num": 0,
                "view_num": 1999
            },
            {
                "date": "20240302",
                "kol_num": 43,
                "order_num": 250,
                "view_num": 2451
            },
            {
                "date": "20240303",
                "kol_num": 42,
                "order_num": 250,
                "view_num": 2959
            },
            {
                "date": "20240304",
                "kol_num": 48,
                "order_num": 250,
                "view_num": 3469
            },
            {
                "date": "20240305",
                "kol_num": 33,
                "order_num": 250,
                "view_num": 3368
            },
            {
                "date": "20240306",
                "kol_num": 37,
                "order_num": 250,
                "view_num": 3447
            },
            {
                "date": "20240307",
                "kol_num": 32,
                "order_num": 250,
                "view_num": 3357
            },
            {
                "date": "20240308",
                "kol_num": 35,
                "order_num": 250,
                "view_num": 3520
            },
            {
                "date": "20240309",
                "kol_num": 31,
                "order_num": 0,
                "view_num": 3325
            },
            {
                "date": "20240310",
                "kol_num": 39,
                "order_num": 250,
                "view_num": 4228
            },
            {
                "date": "20240311",
                "kol_num": 45,
                "order_num": 250,
                "view_num": 3507
            },
            {
                "date": "20240312",
                "kol_num": 37,
                "order_num": 250,
                "view_num": 4634
            },
            {
                "date": "20240313",
                "kol_num": 57,
                "order_num": 250,
                "view_num": 4517
            },
            {
                "date": "20240314",
                "kol_num": 54,
                "order_num": 250,
                "view_num": 4863
            },
            {
                "date": "20240315",
                "kol_num": 41,
                "order_num": 250,
                "view_num": 4099
            },
            {
                "date": "20240316",
                "kol_num": 34,
                "order_num": 250,
                "view_num": 4021
            },
            {
                "date": "20240317",
                "kol_num": 39,
                "order_num": 250,
                "view_num": 5148
            },
            {
                "date": "20240318",
                "kol_num": 32,
                "order_num": 250,
                "view_num": 5115
            },
            {
                "date": "20240319",
                "kol_num": 46,
                "order_num": 250,
                "view_num": 5858
            },
            {
                "date": "20240320",
                "kol_num": 44,
                "order_num": 250,
                "view_num": 4842
            },
            {
                "date": "20240321",
                "kol_num": 49,
                "order_num": 500,
                "view_num": 5488
            },
            {
                "date": "20240322",
                "kol_num": 41,
                "order_num": 250,
                "view_num": 5612
            },
            {
                "date": "20240323",
                "kol_num": 31,
                "order_num": 1000,
                "view_num": 10494
            },
            {
                "date": "20240324",
                "kol_num": 44,
                "order_num": 1000,
                "view_num": 14586
            },
            {
                "date": "20240325",
                "kol_num": 51,
                "order_num": 250,
                "view_num": 7650
            },
            {
                "date": "20240326",
                "kol_num": 52,
                "order_num": 1000,
                "view_num": 16615
            },
            {
                "date": "20240327",
                "kol_num": 62,
                "order_num": 1000,
                "view_num": 13675
            },
            {
                "date": "20240328",
                "kol_num": 76,
                "order_num": 750,
                "view_num": 10500
            }
        ],
        "detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3610906350755930647&origin_type=open_platform&pick_source=v.v12FI",
        "express": "",
        "express_not": "",
        "express_time": "",
        "first_cid": 20005,
        "has_sxt": 1,
        "imgs": [
            "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_ffbe4b9c7cbfa4628cc4a07841264945_sx_157941_www800-800",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_d70e9c8d187a5549e65d1cae551622c2_sx_125490_www800-800",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_b94c7bbd7ef1b9c194211826b96661b4_sx_126124_www800-800",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_70d5fd2bca69098c38f0ff7906194699_sx_124468_www800-800",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_45f694593e27b211d349e22cad8c914d_sx_194836_www968-968",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_82ed4fd30022ac3e1662436577601b6c_sx_103156_www600-800",
            "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_a4d629061d47ba71428dc7fef965e858_sx_104748_www600-800",
            "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_47284d0d14f4cace021a19e77a48789a_sx_106414_www600-800",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_375bf1f1de48ced5d6b06972cfdd7fcc_sx_144928_www900-1200",
            "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TavGerZh_m_a8e337b4af5b1198c5965130b4fc155c_sx_93022_www600-800"
        ],
        "in_stock": 1,
        "kol_num": 763,
        "logistics_info": "48小时内从浙江省发货,运费0元起",
        "msg": "",
        "order_num": 10000,
        "price": 1990,
        "product_id": "3610906350755930647",
        "promotion_activity_id": "",
        "promotion_end_time": "",
        "promotion_start_time": "",
        "sales": 100000,
        "sales_twentyfour": "",
        "second_cid": 20224,
        "service_ratio": "",
        "set_cos_fee": 0,
        "set_cos_ratio": 0,
        "seven_days_sales": 5250,
        "sharable": "true",
        "shop_id": 43148302,
        "shop_name": "依诺女装源头工厂",
        "shop_total_score": {
            "logistics_score": {
                "level": 1,
                "score": "98",
                "text": "物流体验分"
            },
            "product_score": {
                "level": 2,
                "score": "88",
                "text": "商品体验分"
            },
            "service_score": {
                "level": 2,
                "score": "80",
                "text": "商家服务分"
            },
            "shop_score": {
                "level": 2,
                "score": "89",
                "text": "商家体验分"
            }
        },
        "shop_type": 1,
        "sku": {
            "pictures": {
                "1792023364269091": {
                    "big_picture": "https://p26-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_ffbe4b9c7cbfa4628cc4a07841264945_sx_157941_www800-800~tplv-5mmsx3fupr-resize:1200:0.webp",
                    "little_picture": "https://p3-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_ffbe4b9c7cbfa4628cc4a07841264945_sx_157941_www800-800~tplv-5mmsx3fupr-resize:300:0.webp"
                },
                "1792023364269107": {
                    "big_picture": "https://p6-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_d70e9c8d187a5549e65d1cae551622c2_sx_125490_www800-800~tplv-5mmsx3fupr-resize:1200:0.webp",
                    "little_picture": "https://p6-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_d70e9c8d187a5549e65d1cae551622c2_sx_125490_www800-800~tplv-5mmsx3fupr-resize:300:0.webp"
                },
                "1792023364270083": {
                    "big_picture": "https://p6-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_70d5fd2bca69098c38f0ff7906194699_sx_124468_www800-800~tplv-5mmsx3fupr-resize:1200:0.webp",
                    "little_picture": "https://p6-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_70d5fd2bca69098c38f0ff7906194699_sx_124468_www800-800~tplv-5mmsx3fupr-resize:300:0.webp"
                },
                "1792023364270099": {
                    "big_picture": "https://p3-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_b94c7bbd7ef1b9c194211826b96661b4_sx_126124_www800-800~tplv-5mmsx3fupr-resize:1200:0.webp",
                    "little_picture": "https://p3-item.ecombdimg.com/img/ecom-shop-material/TavGerZh_m_b94c7bbd7ef1b9c194211826b96661b4_sx_126124_www800-800~tplv-5mmsx3fupr-resize:300:0.webp"
                }
            },
            "skus": {
                "1792023364269091;1792023364270131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079129346,
                    "stock_num": 3782
                },
                "1792023364269091;1792023364271107": {
                    "effective_price": 1990,
                    "sku_id": 3398380079129602,
                    "stock_num": 4960
                },
                "1792023364269091;1792023364271123": {
                    "effective_price": 1990,
                    "sku_id": 3398380079129858,
                    "stock_num": 7137
                },
                "1792023364269091;1792023364271139": {
                    "effective_price": 1990,
                    "sku_id": 3398380079130114,
                    "stock_num": 4549
                },
                "1792023364269091;1792023364271155": {
                    "effective_price": 1990,
                    "sku_id": 3398380079130370,
                    "stock_num": 4465
                },
                "1792023364269091;1792023364272131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079130626,
                    "stock_num": 4800
                },
                "1792023364269091;1792023364272147": {
                    "effective_price": 1990,
                    "sku_id": 3398380079130882,
                    "stock_num": 4686
                },
                "1792023364269107;1792023364270131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079131138,
                    "stock_num": 1984
                },
                "1792023364269107;1792023364271107": {
                    "effective_price": 1990,
                    "sku_id": 3398380079131394,
                    "stock_num": 1948
                },
                "1792023364269107;1792023364271123": {
                    "effective_price": 1990,
                    "sku_id": 3398380079131650,
                    "stock_num": 1906
                },
                "1792023364269107;1792023364271139": {
                    "effective_price": 1990,
                    "sku_id": 3398380079131906,
                    "stock_num": 1875
                },
                "1792023364269107;1792023364271155": {
                    "effective_price": 1990,
                    "sku_id": 3398380079132162,
                    "stock_num": 1861
                },
                "1792023364269107;1792023364272131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079132418,
                    "stock_num": 1806
                },
                "1792023364269107;1792023364272147": {
                    "effective_price": 1990,
                    "sku_id": 3398380079132674,
                    "stock_num": 1814
                },
                "1792023364270083;1792023364270131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079132930,
                    "stock_num": 1983
                },
                "1792023364270083;1792023364271107": {
                    "effective_price": 1990,
                    "sku_id": 3398380079133186,
                    "stock_num": 1963
                },
                "1792023364270083;1792023364271123": {
                    "effective_price": 1990,
                    "sku_id": 3398380079133442,
                    "stock_num": 1941
                },
                "1792023364270083;1792023364271139": {
                    "effective_price": 1990,
                    "sku_id": 3398380079133698,
                    "stock_num": 1927
                },
                "1792023364270083;1792023364271155": {
                    "effective_price": 1990,
                    "sku_id": 3398380079133954,
                    "stock_num": 1926
                },
                "1792023364270083;1792023364272131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079134210,
                    "stock_num": 1909
                },
                "1792023364270083;1792023364272147": {
                    "effective_price": 1990,
                    "sku_id": 3398380079134466,
                    "stock_num": 1937
                },
                "1792023364270099;1792023364270131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079134722,
                    "stock_num": 1991
                },
                "1792023364270099;1792023364271107": {
                    "effective_price": 1990,
                    "sku_id": 3398380079134978,
                    "stock_num": 1972
                },
                "1792023364270099;1792023364271123": {
                    "effective_price": 1990,
                    "sku_id": 3398380079135234,
                    "stock_num": 1944
                },
                "1792023364270099;1792023364271139": {
                    "effective_price": 1990,
                    "sku_id": 3398380079135490,
                    "stock_num": 1931
                },
                "1792023364270099;1792023364271155": {
                    "effective_price": 1990,
                    "sku_id": 3398380079135746,
                    "stock_num": 1923
                },
                "1792023364270099;1792023364272131": {
                    "effective_price": 1990,
                    "sku_id": 3398380079136002,
                    "stock_num": 1932
                },
                "1792023364270099;1792023364272147": {
                    "effective_price": 1990,
                    "sku_id": 3398380079136258,
                    "stock_num": 1936
                }
            },
            "specs": [
                {
                    "name": "颜色分类",
                    "spec_items": [
                        {
                            "id": "1792023364269091",
                            "name": "黑色"
                        },
                        {
                            "id": "1792023364269107",
                            "name": "酒红色"
                        },
                        {
                            "id": "1792023364270083",
                            "name": "卡其色"
                        },
                        {
                            "id": "1792023364270099",
                            "name": "藕色"
                        }
                    ]
                },
                {
                    "name": "尺码-中国码",
                    "spec_items": [
                        {
                            "id": "1792023364270131",
                            "name": "S码【建议70-85斤】"
                        },
                        {
                            "id": "1792023364271107",
                            "name": "M码【建议86-100斤】"
                        },
                        {
                            "id": "1792023364271123",
                            "name": "L码【建议101-110斤】"
                        },
                        {
                            "id": "1792023364271139",
                            "name": "XL码【建议111-120斤】"
                        },
                        {
                            "id": "1792023364271155",
                            "name": "2XL码【建议121-130斤】"
                        },
                        {
                            "id": "1792023364272131",
                            "name": "3XL码【建议131-150斤】"
                        },
                        {
                            "id": "1792023364272147",
                            "name": "4XL码【建议151-170斤】"
                        }
                    ]
                }
            ]
        },
        "tag_ids": "",
        "third_cid": "",
        "title": "夏季时尚气质吊带裙黑色无袖百搭遮肉显瘦纯色修身打底外穿中长裙",
        "update_time": "",
        "view_num": 168971,
        "app_ver": "1.0.0-5.0",
        "_ddf": "leo",
        "app_ver_check": "ok",
        "format_check": "ok"
    },
    "error": "",
    "secache": "045984abaf22d12b70982a9693dd2280",
    "secache_time": 1711691622,
    "secache_date": "2024-03-29 13:53:42",
    "reason": "",
    "error_code": "0000",
    "cache": 0,
    "api_info": "today: max:15000 all[=++];expires:2031-01-01",
    "execution_time": "0.391",
    "server_time": "Beijing/2024-03-29 13:53:42",
    "client_ip": "127.0.0.1",
    "call_args": {
        "num_iid": "3610906350755930647"
    },
    "api_type": "douyin",
    "server_memory": "3.24MB",
    "last_id": false
}
  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值