java 爬网页代码
文章目录
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
public class Test {
public static void main(String[] args) {
try {
URL url = new URL("http://www.ahzww.net/0/101/");
InputStream input = url.openStream();
String str = IOUtils.toString(input, "gbk");
String[] arr=StringUtils.substringsBetween(str,"
System.out.println(Arrays.toString(arr));
} catch (Exception e) {
e.printStackTrace();
}
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册⭐️ Admin快速开发: https://show.cool-admin.com/
赞 0⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld
赞 0