j集成到后端代码,我是搞java的,直接上代码吧
package blog.rs1314.cn.test;
import java.io.IOException;
import java.lang.ref.SoftReference;
import org.json.JSONArray;
import org.json.JSONObject;
import okhttp3.Call;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* 微信公众号 java微技术
* qq群 java微技术
* @author javawjs
*
*/
public class PiPiXiaTest {
public static void main(String[] args) throws IOException {
String url ="https://h5.pipix.com/s/hukXsy/";
OkHttpClient okHttpClient = new OkHttpClient();
String usedAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1";
Request request = new Request.Builder()
.url(url)
.addHeader("user-agent", usedAgent)
.build();
Call call = okHttpClient.newCall(request);
Response execute = call.execute();
String s = execute.request().url().toString();
execute.close();
s = s.substring(s.indexOf("item")+5, s.indexOf("?"));
String tempurl ="https://h5.pipix.com/bds/webapi/item/detail/?item_id="+s;
SoftReference<OkHttpClient> soft = new SoftReference<OkHttpClient>(okHttpClient);
okHttpClient = soft.get();
request = new Request.Builder()
.url(tempurl)
.addHeader("user-agent", usedAgent)
.build();
call = okHttpClient.newCall(request);
execute = call.execute();
s = execute.body().string();
JSONObject obj = new JSONObject(s);
JSONObject jsonObject = obj.getJSONObject("data");
jsonObject = jsonObject.getJSONObject("item");
jsonObject = jsonObject.getJSONObject("origin_video_download");
JSONArray jsonArray = jsonObject.getJSONArray("url_list");
String string = jsonArray.getJSONObject(0).getString("url");
}
}
运行的结果
然后分享链接到这这里,就可以解析了,完全打造自己的解析免费工具
文章来源于微信公众号 java微技术