이 기사의 예는 Java가 Baidu의 네트워크 디스크의 실제 다운로드 링크를 얻는 방식을 알려줍니다. 참조를 위해 모든 사람을 위해 공유하십시오. 세부 사항은 다음과 같습니다.
여전히 문제가 있습니다. 동일한 IP는 동일한 IP를 얻은 후에 검증 코드가 있으며 관심있는 친구가이를 개선 할 수 있습니다.
뒤로 <map <string, object >> 리턴에는 filename (파일 이름), URL (실제 체인 주소)이 포함됩니다.
httprequest.java는 다음과 같습니다.
Java.io.ioxception; url; public class httpurlconnection = httpurlconnection = httpurlconnection. get "); httpurlconnection.setdoinput (true); httpurlconnection.setdoutput (true); inputStream is = http urlconnection.getInputStream (); inputStreamReader ISR = new inputStreamReamreader (is); bufferedReaderEdReader = new bufleredReader (isr)" ". ; (il = bufferedReader.Readline ()! = null) {re + = il + "/n";} return re;}}
방법 얻기 :
java.util.hashmap import java.util.map; .jsoup; import org.jsoup.nodes.document; public static list <map <string, object >> throws exception {list <string> fs_id = new arraylist <string> (); object = new arraylist <string, object >> (); b = html.indexof ( "yundata.getcon"); int sign_head = html.indexof ( "yundata.sign = /" "); int _foot = html. indexof ("yundata.timestamp "); ( "yundata.timestamp = /" "); int time_foot = html.indexof ("yundata.share_uk "); int share_id_head = html.indexof ("yundata. share_id = /""); yundata.sign "); 문자열 표시 = html.substring (sign_head, sign_foot); sign = sign.substrin. g (sign.indexof ("/"") + 1, sign.indexof ( "/"; "); 문자열 시간 = html.substring (time_head, time_foot); time.substring (time.indexof ( "/" ") + 1, time.indexof ("/";"); share_id_foot); share_id = share_id.substring (share_id.indexof ( "/" " + 1, share_id.indexo f ("/";"); system.out .println (share_id); html = html.substring (a, b); a = html.indexof ( "{/"glansicalpath "); b = html.indexof ("}; ");" "[" "[" + html.substring (a, b + 1) + "] jsonobject jsonObject = jsonObject (0); "utf-8"); ");") +"]"); getString ( "app_id"); if (jsonobject.getStringstring ( "isdir"). "& shareid =" + shareid + "& num = 100 & dir =" + path + "& order = time & desc = 1 & _ =" + time + "& bdstoken = c51077ce0e0e0e0e0e31606612a13fbcd4 & clienttype = 0 & web = 0 & web = 1 & app_id = " + app_id; String filelistjson = httprequest.getData (url1); system.out.println (filelistjson); jsonArray = new JsonArray (" "" "" "" + filleStjson + "]; (0); > (); jsonArray.getJsonObject (i); = httprequest .getData ( "http : // pan. baidu.com/api/shardownload? sign =" + sign + "× tamp =" + time + "& bdstoken = c51077ce0e313160612a13fbcd4 & clienttype = 0 & 웹 = 1 & 웹 = 1 & 웹 = app_id = 250528 & encrypt = 0 & upplex = share & uk = " + uk +"& share_id + "& fid_list =%5b" + fs_id.get (i) + "%5d"); jsonarray jsonarray2 = new JsonArray ( "[" " + fileInfo +"]; getString ( "errno") .Equals ( "0")) {jsonArray2 = new JsonArray (json_data.getString ( "list"); json_data = jsonarray2.getJsonObject (0) Map.put ( "url", json_data.getstring ( "dlink"));} else if (json_data.getstring ( "errno"). equals ( "-20") {return null; // string getVercode () ;} else {return null;} list.add (map);} urn list;}}
이 기사는 모든 사람의 Java 프로그램 설계에 도움이되기를 바랍니다.