this one のようなページのコンテンツをダウンロードし、後で使用するために.txtファイルに書き込もうとしています。jsoupを使用して.txtファイルにURL contetntをダウンロードしようとしています
doc = Jsoup.connect(link).userAgent("Mozilla").get();
String cityInfo = doc.html();
int index = cityInfo.indexOf("},"); // keeps just the first object as it has the highest score.
String cityInfo1 = cityInfo.substring(index+1) + "}]}"; // gets the object in the correct format as some characters are not selected when downloading
bw1.write(cityInfo1); //saves json object into text file
私はこのエラーを得続ける、と私はignoreContentType(true)
メソッドを使用している場合、それだけでエラーを取り除くと私のテキストファイルが空のまま。
"Exception in thread "main"
org.jsoup.UnsupportedMimeTypeException: Unhandled content type.
Must be text/*, application/xml, or application/xhtml+xml.
Mimetype=application/json, URL=http://transport.opendata.ch/v1/locations?query=Aarau"
? – Tim
ページ全体をテキストとしてのみダウンロードし、後で処理したい。何をお勧めしますか? – BlueWookie
JSONフォーマットをチェックしてください:https://en.wikipedia.org/wiki/JSON – Tim