Package org.osm.jsoup.nodes

Examples of org.osm.jsoup.nodes.Element


    /**
     * 获取视频简介
     */
    String summary = "";
    try {
      Element el = doc.getElementById("long");
      summary = el.select(".item").get(0).html();
    } catch (Exception e) {
    }

    Video video = new Video();
    video.setTitle(title);
View Full Code Here


    String htmlCode = getElementAttrById(doc, "outSideHtmlCode", "value");

    /**
     * 获取视频缩略图
     */
    Element picEt = doc.getElementById("plVideosList");
    String time = null;
    String pic = null;
    if (picEt != null) {
      Elements pics = picEt.getElementsByTag("img");
      pic = pics.get(0).attr("src");

      /**
       * 获取视频时长
       */
      Element timeEt = picEt.select("span.review>cite").first();
      time = timeEt.text();
    } else {
      pic = doc.getElementsByClass("s_pic").first().text();
    }

    /**
 
View Full Code Here

    String title = doc.title().split("-")[0].trim();

    /**
     * 获取视频缩略图
     */
    Element picEt = doc.getElementsByClass("summary").first();
    String pic = picEt.getElementsByTag("img").first().attr("src");

    /**
     * 视频简介
     */
    String summary = doc.select("meta[name=Description]").attr("content");

    /**
     * 获取视频地址
     */
    Element flashEt = doc.getElementById("video-share-code");
    doc = Jsoup.parse(flashEt.attr("value"));
    String flash = doc.select("embed").attr("src");

    Video video = new Video();
    video.setTitle(title);
    video.setThumbnail(pic);
View Full Code Here

   * @param attrName
   *            属于名
   * @return 返回属性值
   */
  private static String getElementAttrById(Document doc, String id, String attrName) throws Exception {
    Element et = doc.getElementById(id);
    String attrValue = et.attr(attrName);
    return attrValue;
  }
View Full Code Here

TOP

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

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.