获取内容android错误

时间:2014-07-15 16:16:17

标签: java android

启动get content

时遇到此错误
  

at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)   07-15 12:12:17.420:W / System.err(2368):at java.net.URL.openStream(URL.java:470)   07-15 12:12:17.420:W / System.err(2368):at com.axcel.mp3tube.GetContentFiles.makeurl(GetContentFiles.java:25)   07-15 12:12:17.420:W / System.err(2368):at com.axcel.mp3tube.GetContentFiles $ 1.run(GetContentFiles.java:44)

这是我使用的方法:       包com.axcel.mp3tube;

import java.io.BufferedReader;

import java.io.InputStreamReader;
  import java.net.URL;
  import java.util.Date;

public class GetContentFiles {

static long lDateTime = new Date().getTime();

String strLong = Long.toString(lDateTime);

static String hash;



// Id do video
public static String makeurl(String url) throws Exception {

    URL yahoo = new URL("http://www.youtube-mp3.org/a/itemInfo/?video_id="
            + url + "&ac=www&t=grp&r=&r=" + generatelengh(url + lDateTime));
    BufferedReader in = new BufferedReader(new InputStreamReader(
            yahoo.openStream()));

    String inputLine;

    String returna = null;
    while ((inputLine = in.readLine()) != null)

        returna = inputLine;
    in.close();

    return returna;
}


public static String ThreadOpen(final String video_id) {
    Thread thread = new Thread() {
        @Override
        public void run() {
            try {
                hash = makeurl(video_id);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };
    thread.start();

    return hash;

}

public static int generatelengh(String a) {
    int __AM = 65521;
    int c = 1, b = 0, d, e;
    for (e = 0; e < a.length(); e++) {
        d = a.charAt(e);
        c = (c + d) % __AM;
        b = (b + c) % __AM;
    }
    return b << 16 | c;
}
}

我在我的活动中使用它 String hash = GetContentFiles.ThreadOpen(linkvideo2);

0 个答案:

没有答案