Update CrawlerTools.java

This commit is contained in:
xixu-me committed 2024-07-02 18:24:38 +08:00
1 parent 747e0e5bf6
commit 4bb0f15106
1 file changed
+1
@@ -12,6 +12,7 @@ import java.util.regex.Pattern;
public class CrawlerTools { public class CrawlerTools {
public static String get(String urlStr, String charset) throws IOException { public static String get(String urlStr, String charset) throws IOException {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
@SuppressWarnings("deprecation")
URL url = new URL(urlStr); URL url = new URL(urlStr);
HttpURLConnection con = (HttpURLConnection) url.openConnection(); HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("User-Agent", con.setRequestProperty("User-Agent",