I try to readout the Office 365 Website to compare it to a proxy configuration. But i cant get the select right so that it just gets me a specific section of those urls and ip addresses.
public class Office365WebsiteParser {
Document doc = null;
String WebseitenInhalt;
public void Parser() {
System.setProperty("http.proxyHost", "xxx");
System.setProperty("http.proxyPort", "8081");
System.setProperty("https.proxyHost", "xxx");
System.setProperty("https.proxyPort", "8081");
for (int i = 1; i <= 5; i++) {
try {
doc = Jsoup.connect("https://technet.microsoft.com/de-de/library/hh373144.aspx").userAgent("Mozilla").get();
break; // Break immediately if successful
} catch (IOException e) {
// Swallow exception and try again
System.out.println("jsoup Timeout occurred " + i + " time(s)");
}
}
if (doc == null) {
System.out.println("Connection timeout after 5 tries");
} else { // Wenn alles funktioniert hat Webseite auswerten
Elements urls_Office365_URLs = doc.select("div.codeSnippetContainerCode");
// HTML auswahl der Webseite nach div class und div id
// urls_Office365_URLs_global = urls_Office365_URLs;
WebseitenInhalt=urls_Office365_URLs.text();
}
}
public void Print() {
System.out.println(WebseitenInhalt);
}
public String get() {
return WebseitenInhalt;
}
}
I just want to select the containers like this:
<div class="codeSnippetContainerCodeContainer"> <div class="codeSnippetToolBar"> <div class="codeSnippetToolBarText"> <a name="CodeSnippetCopyLink" style="display: none;" title="In Zwischenablage kopieren" href="javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode('CodeSnippetContainerCode_0f6f9acf-6aa4-471f-8600-f8d059f95493');">Kopieren</a> </div> </div> <div id="CodeSnippetContainerCode_0f6f9acf-6aa4-471f-8600-f8d059f95493" class="codeSnippetContainerCode" dir="ltr"> <div style="color:Black;"><pre> *.live.com *.officeapps.live.com *.microsoft.com *.glbdns.microsoft.com *.microsoftonline.com *.office365.com *.office.com Portal.Office.com *.onmicrosoft.com *.microsoftonline-p.com^ *.microsoftonline-p.net^ *.microsoftonlineimages.com^ *.microsoftonlinesupport.net^ *.msecnd.net^ *.msocdn.com^ *.msn.com^ *.msn.co.jp^ *.msn.co.uk^ *.office.net^ *.aadrm.com^^ *.cloudapp.net^^ *.activedirectory.windowsazure.com^^^ *.phonefactor.net^^^ </pre></div> </div> </div> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.