【问题标题】:JSoup Screen Scraping With Many Divs带有许多 div 的 JSoup 屏幕抓取
【发布时间】:2013-08-02 11:51:25
【问题描述】:

我有一个想用 android 抓取的页面,想要的内容是这样的:

body
div#wrapper
div#mainContentArea
div#scheduleModule
div#scheduleDayView
div#scheduleDayViewScroll 
div#scheduleItemContainer
div#eventContainer
div#SSPP_o090570*A*
div.eventInfo
p.eventText
span.eventInfoDefault

如何使用 jsoup 访问 span?

【问题讨论】:

    标签: android jsoup


    【解决方案1】:

    如果您不想被带到街上并因违法而被鞭打,那么您将在那里拆分那段文字。

    不管怎样,你想找到 class 为 eventInfoDefault 的 span 吗?嗯:

    Document site = Jsoup.connect("http://www.example.com");
    Element span = site.select("span.eventInfoDefault").first();
    //Proceed to do whatever you want with that below.
    

    来源:http://jsoup.org/cookbook/extracting-data/selector-syntax

    【讨论】:

      猜你喜欢
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-20
      • 2011-07-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多