作成中のプロキシ スクレーパーについてサポートが必要です。私のアプリケーションは、一見理由もなく例外をスローしています。
マイコード
package com.ElwynDev.PastBinBot;
import java.io.IOException;
import java.util.HashSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ProxyScraper {
public static void ScrapProxy(int Pages) {
final int[] searchIds = new int[] { 225957, 278235, 240804, 258000, 227364, 244555, 438084, 438085, 438086, 438087, 438088};
final String searchUrl = "http://www.proxyfire.net/forum/showthread.php?t=56861?";
final String proxyExtractingRegex = "[1-9]{2,3}.[1-9]{2,3}.[1-9]{2,3}.[1-9]{2,3}";
Pattern r = Pattern.compile(proxyExtractingRegex);
HashSet<String> proxyHashSet = new HashSet<String>();
for(int searchId : searchIds) {
Matcher m = null;
try {
m = r.matcher(ProxyHandle.get(searchUrl + searchId, null, Pages));
while(true) {
if(m.find()){
proxyHashSet.add(m.group());
}
else
break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
for(String proxy : proxyHashSet) {
FileWrighter.logTo("proxy.txt", proxy + "\n");
}
}
};
Exception in thread "main" java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Unknown Source)
at java.util.regex.Matcher.reset(Unknown Source)
at java.util.regex.Matcher.<init>(Unknown Source)
at java.util.regex.Pattern.matcher(Unknown Source)
at com.ElwynDev.PastBinBot.ProxyScraper.ScrapProxy(ProxyScraper.java:24)
at com.ElwynDev.PastBinBot.Main.main(Main.java:17)