本文整理了Java中org.jsoup.nodes.Document.toString()
方法的一些代码示例,展示了Document.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.toString()
方法的具体详情如下:
包路径:org.jsoup.nodes.Document
类名称:Document
方法名:toString
暂无
代码示例来源:origin: javaee-samples/javaee7-samples
public static String formatHTML(String html) {
try {
return parse(html, "", xmlParser()).toString();
} catch (Exception e) {
return html;
}
}
代码示例来源:origin: JpressProjects/jpress
public String replaceSrcTemplateSrcPath(String content) {
if (StrUtils.isBlank(content)) {
return content;
}
Document doc = Jsoup.parse(content);
Elements jsElements = doc.select("script[src]");
replace(jsElements, "src");
Elements imgElements = doc.select("img[src]");
replace(imgElements, "src");
Elements linkElements = doc.select("link[href]");
replace(linkElements, "href");
return doc.toString();
}
代码示例来源:origin: RipMeApp/ripme
@Override
public void rip() throws IOException {
LOGGER.info(" Retrieving " + this.url);
String html = Http.url(this.url).get().toString();
if (html.contains("__fileurl = '")) {
LOGGER.error("WTF");
}
List<String> vidUrls = Utils.between(html, "__fileurl = '", "';");
if (vidUrls.isEmpty()) {
throw new IOException("Could not find video URL at " + url);
}
String vidUrl = vidUrls.get(0);
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
waitForThreads();
}
}
代码示例来源:origin: RipMeApp/ripme
.data(postData)
.post();
String jsonString = doc.toString();
jsonString = jsonString.substring(jsonString.indexOf("<!json>") + "<!json>".length());
jsonString = jsonString.substring(0, jsonString.indexOf("<!>"));
代码示例来源:origin: RipMeApp/ripme
.cookies(cookies)
.get();
if (doc.toString().contains("IP address will be automatically banned")) {
if (retries == 0) {
throw new IOException("Hit rate limit and maximum number of retries, giving up");
代码示例来源:origin: RipMeApp/ripme
.post();
String body = doc.toString();
if (!body.contains("<div")) {
break;
代码示例来源:origin: RipMeApp/ripme
.data(postData)
.post();
String[] jsonStrings = doc.toString().split("<!>");
JSONObject json = new JSONObject(jsonStrings[jsonStrings.length - 1]);
JSONArray videos = json.getJSONArray("all");
代码示例来源:origin: wangdan/AisenWeiBo
String html = dom.toString();
html = html.replace("<html>", "<html id='all' >").replace("</head>", js + "</head>")
.replace("action-type=\"submit\"", "action-type=\"submit\" id=\"submit\"");
Logger.d(TAG, pwdAccount.toString());
html = dom.toString();
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public String workInBackground(Void... p) throws TaskException {
try {
AccountBean accountBean = AccountUtils.getLogedinAccount();
if (TextUtils.isEmpty(accountBean.getAccount()) || TextUtils.isEmpty(accountBean.getPassword()))
throw new TaskException("", getString(R.string.account_fillaccount_faild));
String js = FileUtils.readAssetsFile("mobile.js", GlobalContext.getInstance());
js = js.replace("%username%", accountBean.getAccount());
js = js.replace("%password%", accountBean.getPassword());
Document dom = Jsoup.connect(url).get();
String html = dom.toString();
html = html.replace("</head>", js + "</head>");
return html;
} catch (Exception e) {
e.printStackTrace();
}
throw new TaskException("", getString(R.string.account_fillaccount_faild));
}
代码示例来源:origin: ahmetaa/zemberek-nlp
.get();
doc = doc.normalise();
String htmlContent = doc.toString();
Files.write(
out,
代码示例来源:origin: org.apache.sling/org.apache.sling.hapi.client
@Override
public String toString() {
return this.jsoupDocument.toString();
}
代码示例来源:origin: bluetata/crawler-jsoup-maven
/**
* 方法说明:将document对象转换成String类型
*
* @param doc 所要转换的document对象
* @return _html 以Stirng类型返回被访问网页的html.如果doc为null的情况方法返回空串""。
* @throws Exception
*/
public static String covertDoc2Str(Document doc) throws Exception {
return doc == null ? "" : doc.toString().replaceAll(UtilsConstants.AMP, UtilsConstants.AMPERSAND);
}
代码示例来源:origin: trivago/cluecumber-report-plugin
/**
* Returns prettified HTML
*
* @param html The source html.
* @return The prettified HTML.
*/
static String prettifyHtml(String html) {
return Jsoup.parse(html).toString().trim();
}
代码示例来源:origin: guru.nidi.raml/raml-doc-client
private void writeToFile(Document html, File file) throws IOException {
//new Document.OutputSettings().
try (final OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file.getAbsolutePath()), "utf-8")) {
out.write(html.toString());
}
}
代码示例来源:origin: javaee/security-soteria
public static String formatHTML(String html) {
try {
return parse(html, "", xmlParser()).toString();
} catch (Exception e) {
return html;
}
}
代码示例来源:origin: org.glassfish.soteria.test/common
public static String formatHTML(String html) {
try {
return parse(html, "", xmlParser()).toString();
} catch (Exception e) {
return html;
}
}
代码示例来源:origin: bluetata/crawler-jsoup-maven
public static void main(String[] args) {
// grab login form page first
try {
Document doc = JsoupUtil.getDocument("https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dvideogames&field-keywords=iphone");
System.out.println(doc.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-cli-forms-migration
private String readTaskFormName(DataInputAssociation inputAssociation) {
Optional<FormalExpression> optional = inputAssociation.getAssignment()
.stream()
.filter(assignment -> assignment.getFrom() != null && assignment.getFrom() instanceof FormalExpression)
.map(assignment -> (FormalExpression)assignment.getFrom())
.findAny();
if(optional.isPresent()) {
return Parser.xmlParser().parseInput(optional.get().getBody(), "").toString();
}
return "";
}
代码示例来源:origin: com.soulgalore/crawler
private void crawl() {
final Injector injector = Guice.createInjector(new CrawlModule());
final Crawler crawler = injector.getInstance(Crawler.class);
final CrawlerResult result = crawler.getUrls(getConfiguration());
for (HTMLPageResponse response : result.getVerifiedURLResponses()) {
if (response.getBody().toString().contains(keyword)) {
System.out.println(response.getUrl());
}
}
crawler.shutdown();
}
代码示例来源:origin: soulgalore/crawler
private void crawl() {
final Injector injector = Guice.createInjector(new CrawlModule());
final Crawler crawler = injector.getInstance(Crawler.class);
final CrawlerResult result = crawler.getUrls(getConfiguration());
for (HTMLPageResponse response : result.getVerifiedURLResponses()) {
if (response.getBody().toString().contains(keyword)) {
System.out.println(response.getUrl());
}
}
crawler.shutdown();
}
内容来源于网络,如有侵权,请联系作者删除!