Package org.osm.jsoup.nodes

Examples of org.osm.jsoup.nodes.Document


   * @param url
   * @return
   * @throws Exception
   */
  public static Video getYinYueTaiVideo(String url) throws Exception {
    Document doc = getURLContent(url);

    /**
     * 获取视频地址
     */
    String flash = getElementAttrById(doc, "flashCode", "value");

    /**
     * 视频标题
     */
    String title = doc.getElementById("videoTitle").html() + " - " + doc.getElementById("videoArtistName").html();

    /**
     * 视频内容
     */
    String summary = doc.getElementById("videoContent").select("span").first().html();

    /**
     * 视频缩略图
     */
    String thumbnail = doc.select("meta[property=og:image]").attr("content");

    Video video = new Video();
    video.setTitle(title);
    video.setThumbnail(thumbnail);
    video.setFlashUrl(flash);
View Full Code Here


  /**
   * 获取网页的内容
   */
  private static Document getURLContent(String url) throws Exception {
    Document doc = Jsoup.connect(url).data("query", "Java").userAgent("Mozilla").cookie("auth", "token").timeout(5000).get();
    return doc;
  }
View Full Code Here

TOP

Related Classes of org.osm.jsoup.nodes.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.