Json关键词搜索蘑菇街商品列表数据,蘑菇街商品列表接口,蘑菇街API接口

2023-06-26 15:35:22 浏览数 (1)

蘑菇街是中国知名的女性时尚电商平台,成立于2011年。主要经营女装、鞋包、配饰、美妆、家居等商品,致力于为年轻时尚女性提供便捷、个性化、多元化的购物体验。蘑菇街的商品覆盖面广,价格实惠,向用户提供高质量、高性价比的产品。同时,蘑菇街也是社交电商的先驱之一,为消费者提供了一种可信赖、愉悦的购物体验。

mogujie.item_search-关键词搜索蘑菇街商品列表数据

1.请求方式:HTTP POST GET

2.请求地址:http://c0b.cc/R4rbK2 

3.请求示例(复制Taobaoapi2014): 

代码语言:javascript复制
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-vxx.Taobaoapi2014.cn/mogujie/item_search/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&q=鞋子&start_price=&end_price=&page=&cat=&discount_only=&sort=&page_size=&seller_info=&nick=&ppath=";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

0 人点赞