http://jodd.org/doc/jerry/index.html
http://www.oschina.net/code/snippet_12_7758
public class AllMusicNewReleases { |
03 | public static void main(String[] args) throws IOException { |
05 | // download the page super-efficiently |
06 | File file = new File(SystemUtil.getTempDir(), "allmusic.html" ); |
07 | NetUtil.downloadFile( "http://allmusic.com" , file); |
09 | // create Jerry, i.e. document context |
10 | Jerry doc = Jerry.jerry(FileUtil.readString(file)); |
13 | doc.$( "div#new_releases div.list_item" ).each( new JerryFunction() { |
14 | public boolean onNode(Jerry $ this , int index) { |
15 | System.out.println( "-----" ); |
16 | System.out.println($ this .$( "div.album_title" ).text()); |
17 | System.out.println($ this .$( "div.album_artist" ).text().trim()); |