访问不到某api的问题,求教
http://i.y.qq.com/s.music/fcgi-bin/search_for_qq_cp?g_tk=938407465&uin=0&format=jsonp&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=h5&needNewCode=1&w=%E5%91%A8%E6%9D%B0%E4%BC%A6&zhidaqu=1&catZhida=1&t=0&flag=1&ie=utf-8&sem=1&aggr=0&perpage=20&n=20&p=1&remoteplace=txt.mqq.all&_=1459991037831&jsonpCallback=jsonp4
这个api我一直访问不到,不知道是这个api本身不能被Android访问到呢,还是我写得有问题?求教。
这个api我一直访问不到,不知道是这个api本身不能被Android访问到呢,还是我写得有问题?求教。
@GET("http://i.y.qq.com/s.music/fcgi-bin/search_for_qq_cp")
Observable<ResponseBody> getMainList(
@Query("g_tk") String g_tk, @Query("uin") String uin, @Query("format") String format, @Query("inCHarset") String inCHarset, @Query("outCharset") String outCharset,
@Query("notice") String notice, @Query("platform") String platform, @Query("needNewCode") String needNewCode, @Query("w") String w,
@Query("zhidaqu") String zhidaqu, @Query("catZhida") String catZhida, @Query("t") String t, @Query("flag") String flag,
@Query("ie") String ie, @Query("sem") String sem, @Query("appr") String appr, @Query("perpage") String perpage,
@Query("n") String n, @Query("p") String p, @Query("remoteplace") String remoteplace, @Query("_") String _,
@Query("jsonCallback") String jsonCallback);private <T> T configReforit(Class<T> service, String url) {
retrofit = new Retrofit.Builder()
.baseUrl(url)
.client(configClient())
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
return retrofit.create(service);
}
public OkHttpClient configClient() {
OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder();
//为所有请求添加头部 Header 配置的拦截器
Interceptor headerIntercept = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder builder = chain.request().newBuilder();
Request request = builder
.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8")
.addHeader("Cache-Control", "no-cache")
.addHeader("Connection", "keep-alive")
.addHeader("Cookie", "RK=RZw4SVlgHd; ptcz=7754687f60603c92040a1409de1f879b17ef63824c632740d194dcb40a33bfc5; pgv_pvi=3170554880; pgv_pvid=705162820; ts_uid=8818401641; eas_sid=Y1N5F3z652W8h5m8g467B3a8n8; LW_uid=r1x5i3r6V298W5E8Y458n0y0R0; pac_uid=1_409023706; tvfe_boss_uuid=676d095a4481997c; _ga=GA1.2.902557457.1542336313; ts_refer=xui.ptlogin2.qq.com/cgi-bin/xlogin; LW_sid=s1J5R4S7m6K8q7R8W0C486n3j0; luin=o0409023706; lskey=00010000a807d972761c2cce1d1d2c98dba32a697f867b644e427c56b2fee71ea1422d8fa30a48e7773810e1; o_cookie=409023706; pgv_info=ssid=s9502803040; uin=o0409023706; ptisp=ctc; qqmusic_uin=; qqmusic_key=; qqmusic_fromtag=; skey=@py2pb0vna; yqq_stat=0; pgv_si=s8344146944")
.addHeader("Host", "i.y.qq.com")
.addHeader("Origin", "http://y.qq.com/")
.addHeader("Pragma", "no-cache")
.addHeader("Referer", "http://y.qq.com/")
.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36")
.build();
return chain.proceed(request);
}
};
// Log信息拦截器
if (BuildConfig.DEBUG) {
Interceptor loggingIntercept = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
ResponseBody responseBody = response.body();
BufferedSource source = responseBody.source();
// Buffer the entire body.
source.request(Long.MAX_VALUE);
Buffer buffer = source.buffer();
Charset UTF8 = Charset.forName("UTF-8");
Log.d("REQUEST_JSON", buffer.clone().readString(UTF8));
String logJson = buffer.clone().readString(UTF8);
if (logJson.length() > 4000) {
for (int i = 0; i < logJson.length(); i += 4000) {
if (i + 4000 < logJson.length()) {
Log.d("REQUEST_JSON", logJson.substring(i, i + 4000));
} else {
Log.d("REQUEST_JSON", logJson.substring(i, logJson.length()));
}
}
}
Log.d("REQUEST_URL", request.toString());
return response;
}
};
okHttpClient.addInterceptor(loggingIntercept);
}
okHttpClient.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
okHttpClient.addNetworkInterceptor(headerIntercept);
return okHttpClient.build();
}
...全文
相关推荐
串口通信关于串口找不到的问题
串口通信关于串口找不到的问题(我开始也被困扰了好久,终于解决,与大家分享一下)
.net 解决web api 获取不到文件的问题
.net 解决web api 获取不到文件的问题,全新的文件流获取方式
springboot记录api的访问次数
springboot入门工程,可是开始计数,终止计数,清空计数.只保存最近一分钟以内的访问次数
pyinstaller打包找不到文件的问题解决
主要介绍了pyinstaller打包找不到文件的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
k8s restful api 访问
restful api访问k8s集群,增删改查信息。 需要预先创建访问权限的配置。 官网api文档 https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/ 下面罗列部分api curl -u admin:admin “https://localhost:6443/api/v1” -k curl -u admin:admin “https://localhost:6443/api/v1/pods” -k curl -u admin:admin “https://localhost:6443/api/v1/namesp


