通过关键字采集PDD商品列表

77 篇文章 1 订阅

item_search - 根据关键词取商品列表

公共参数

在这里插入图片描述

请求示例

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/pinduoduo/item_search/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&q=女装&start_price=0&end_price=0&page=1&cat=0&discount_only=&sort=&page_size=";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

请求参数

请求参数:q=女装&start_price=0&end_price=0&page=1&cat=0&discount_only=&sort=&page_size=

参数说明:q:关键词, sort:排序[bid,_bid,_sale,sale] (bid:商品价格,sale:销量,加_前缀为从大到小排序)

注册免费测试 点击注册

响应参数

在这里插入图片描述
响应示例


Result Object:
---------------------------------------
{
	"items": {
		"keyword": "女装",
		"page": "1",
		"real_total_results": 220,
		"total_results": 220,
		"list_count": 20,
		"item": [
			{
				"title": "冰丝高腰阔腿裤女春夏小个子垂感直筒裤女韩版宽松显高休闲拖地裤",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-05-26/e8743e0d2cc3f247d66c36053c739185.jpeg",
				"price": 13.14,
				"promotion_price": 13.14,
				"sales": 100000,
				"num_iid": 106126652542,
				"sample_id": "",
				"seller_nick": "云米露女装旗舰店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=106126652542"
			},
			{
				"title": "2022新款夏季黑色阔腿裤女网红裤显瘦高腰垂感小个子垂感冰丝裤子",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-05-09/4b27deec18fb60ca669195db8cc6e83b.jpeg",
				"price": 18.39,
				"promotion_price": 18.39,
				"sales": 100000,
				"num_iid": 335337103674,
				"sample_id": "",
				"seller_nick": "百大针织服饰店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=335337103674"
			},
			{
				"title": "拼接阔腿裤女春夏2022年新款宽松直筒运动裤显瘦休闲卫裤子ins潮",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-03-25/761a0d5e387ae657863a56eab4d67973.jpeg",
				"price": 9.8,
				"promotion_price": 9.8,
				"sales": 52000,
				"num_iid": 340702714880,
				"sample_id": "",
				"seller_nick": "钡珀琳女装旗舰店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=340702714880"
			},
			{
				"title": "单/套装女时尚韩版冰丝直筒阔腿裤显瘦减龄宽松短款上衣两件套潮",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-07-16/611a94cc34ebd8b977e7d5d3cc9a5c3c.jpeg",
				"price": 14.9,
				"promotion_price": 14.9,
				"sales": 2208,
				"num_iid": 390424991428,
				"sample_id": "",
				"seller_nick": "梦雅漫女装店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=390424991428"
			},
			{
				"title": "【2件套】套装秋冬新款仿獭兔毛钉珠皮草毛毛短外套加厚大衣女装",
				"pic_url": "https://omsproductionimg.yangkeduo.com/images/2018-06-06/463c0e2a5580ba3266846e41fe3e444a.jpeg",
				"price": 95.4,
				"promotion_price": 95.4,
				"sales": 41000,
				"num_iid": 1620002566,
				"sample_id": "",
				"seller_nick": "果果家气质女装",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=1620002566"
			},
			{
				"title": "棉绸睡裤女夏季薄款棉绸阔腿裤网红爆款可外穿人造棉大码家居裤子",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2021-02-20/6396cfdc8548fcff8b94b2a6cae00e8f.jpeg",
				"price": 9.5,
				"promotion_price": 9.5,
				"sales": 100000,
				"num_iid": 220323475299,
				"sample_id": "",
				"seller_nick": "心仪儿",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=220323475299"
			},
			{
				"title": "背心女黑色学生外穿韩版短款百搭背带运动露肚脐内穿打底衫吊带女",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2020-06-30/cb0659f60f7d1b84c863e196a762cae7.jpeg",
				"price": 6.8,
				"promotion_price": 6.8,
				"sales": 100000,
				"num_iid": 8806339015,
				"sample_id": "",
				"seller_nick": "悠悠女装YY",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=8806339015"
			},
			{
				"title": "【买一送一】冰丝吊带小背心女夏无袖短款内搭修身打底衫外穿上衣",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-03-01/3c5e0ffb36e1fc08b2abd7f36a395be6.jpeg",
				"price": 7.94,
				"promotion_price": 7.94,
				"sales": 90000,
				"num_iid": 331454455619,
				"sample_id": "",
				"seller_nick": "NANA衣舍",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=331454455619"
			},
			{
				"title": "基础薄款纯色防晒开衫衣小心机2022夏季韩版宽松休闲透气外套女潮",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-06-27/4a5ae2ea3ac62c337f4fb5202e1007ea.jpeg",
				"price": 7.89,
				"promotion_price": 7.89,
				"sales": 10000,
				"num_iid": 381186457717,
				"sample_id": "",
				"seller_nick": "上瘾ADDICTIVE",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=381186457717"
			},
			{
				"title": "顶瓜瓜无痕内衣女薄款无钢圈聚拢运动睡眠背心式文胸胸罩美背大码",
				"pic_url": "https://img.pddpic.com/gaudit-image/2021-12-02/86a716f24c95aeb974cef70249d349ab.jpeg",
				"price": 28.9,
				"promotion_price": 28.9,
				"sales": 17000,
				"num_iid": 306748697436,
				"sample_id": "",
				"seller_nick": "顶瓜瓜布丁专卖店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=306748697436"
			},
			{
				"title": "2件装】吊带睡裙女夏性感美背中长款A字裙大码宽松显瘦打底连衣裙",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2020-02-23/021be6d7f3107872d3e8359530642e96.jpeg",
				"price": 14.24,
				"promotion_price": 14.24,
				"sales": 32000,
				"num_iid": 88186557231,
				"sample_id": "",
				"seller_nick": "英妃儿时尚女装",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=88186557231"
			},
			{
				"title": "俞兆林文胸无钢圈前扣棉背心式大码裹胸聚拢内衣女中老年妈妈胸罩",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2020-04-14/d5ee9eb57df431767210fca598ad98d7.jpeg",
				"price": 22.68,
				"promotion_price": 22.68,
				"sales": 100000,
				"num_iid": 87113651300,
				"sample_id": "",
				"seller_nick": "俞兆林伊格曼专卖店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=87113651300"
			},
			{
				"title": "多款 冰丝 性感吊带睡衣女夏背心胖mm加大宽松薄款睡裙",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2019-07-04/96216e4594873c92dd9bd6ee42182033.jpeg",
				"price": 6.99,
				"promotion_price": 6.99,
				"sales": 91000,
				"num_iid": 21428521393,
				"sample_id": "",
				"seller_nick": "诚诚睡衣",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=21428521393"
			},
			{
				"title": "冰丝性感睡衣女夏冰丝绸深V领极度诱惑低胸露背吊带睡裙夏天薄款",
				"pic_url": "https://img.pddpic.com/gaudit-image/2021-10-09/909de3b9c9dbb8478652d047811683be.jpeg",
				"price": 8.28,
				"promotion_price": 8.28,
				"sales": 15000,
				"num_iid": 126154084180,
				"sample_id": "",
				"seller_nick": "晨美梦",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=126154084180"
			},
			{
				"title": "性感睡衣女秋冬2022年新款夏季丝绸蕾丝火辣带胸垫纯欲风吊带睡裙",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-01-28/1f95fdf6664dfcd1eb25bc8d39b72d45.jpeg",
				"price": 16.9,
				"promotion_price": 16.9,
				"sales": 100000,
				"num_iid": 325515093211,
				"sample_id": "",
				"seller_nick": "店店爆单",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=325515093211"
			},
			{
				"title": "抹胸式内衣女聚拢无痕超薄款大胸显胸小裹胸无钢圈小文胸罩收副乳",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-02-07/e9ce585a4d667475f648d421c4aa0c8a.jpeg",
				"price": 12.48,
				"promotion_price": 12.48,
				"sales": 3593,
				"num_iid": 325765470308,
				"sample_id": "",
				"seller_nick": "心柚内衣",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=325765470308"
			},
			{
				"title": "仿皮草外套女冬季新款仿獭兔毛皮草外套女加厚保暖羊羔毛毛绒大衣",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2020-10-30/163000794071726249967237f835ce7e.jpeg",
				"price": 49.6,
				"promotion_price": 49.6,
				"sales": 100000,
				"num_iid": 194761802494,
				"sample_id": "",
				"seller_nick": "娅莎芭尔",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=194761802494"
			},
			{
				"title": "白色半透明情趣火辣冰丝睡裙可爱骚吊带无袖背心夏季女士睡衣裙子",
				"pic_url": "https://t00img.yangkeduo.com/goods/images/2021-03-22/88fb61dea7a01f90246cab179a88e9e2.jpeg",
				"price": 15.8,
				"promotion_price": 15.8,
				"sales": 100000,
				"num_iid": 227475779007,
				"sample_id": "",
				"seller_nick": "馨腾睡衣店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=227475779007"
			},
			{
				"title": "性感睡衣女2021年新款冬季金丝绒春秋吊带睡裙睡袍家居服套装",
				"pic_url": "https://img.pddpic.com/gaudit-image/2022-01-12/bbeab1d0185d584d13f60d416b8dad76.jpeg",
				"price": 39,
				"promotion_price": 39,
				"sales": 3017,
				"num_iid": 323226216845,
				"sample_id": "",
				"seller_nick": "蝶妃梦里官方旗舰店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=323226216845"
			},
			{
				"title": "性感挂脖睡裙露背本命年大红新婚透视双层网纱裙摆家居服套装",
				"pic_url": "https://img.pddpic.com/gaudit-image/2021-12-19/b9169fb5ba47b752c0e9d58431a18c66.jpeg",
				"price": 29.9,
				"promotion_price": 29.9,
				"sales": 117,
				"num_iid": 314426994196,
				"sample_id": "",
				"seller_nick": "夜迷离情趣小店",
				"post_fee": "",
				"area": "",
				"detail_url": "http://yangkeduo.com/goods.html?goods_id=314426994196"
			}
		]
	},
	"error_code": "0000",
	"reason": "ok",
	"secache": "a8881ed5637e3c7e84f03acdc86be64f",
	"secache_time": 1661410680,
	"secache_date": "2022-08-25 14:58:00",
	"translate_status": "",
	"translate_time": 0,
	"language": {
		"default_lang": "cn",
		"current_lang": "cn"
	},
	"error": "",
	"cache": 0,
	"api_info": "today:108 max:10100 all[239=108+76+55];expires:2030-12-31",
	"execution_time": "1.086",
	"server_time": "Beijing/2022-08-25 14:58:00",
	"client_ip": "106.6.39.155",
	"call_args": {
		"q": "女装",
		"start_price": "0",
		"end_price": "0",
		"page": "1",
		"cat": "0"
	},
	"api_type": "pinduoduo",
	"translate_language": "zh-CN",
	"translate_engine": "baidu",
	"server_memory": "3.19MB",
	"request_id": "gw-3.63071d771a97e",
	"last_id": "1174478026"
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值