Advertisement
filebot

Groovy Grab

Jul 13th, 2014
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.38 KB | None | 0 0
  1. @Grab('org.jsoup:jsoup')
  2.  
  3. def page = org.jsoup.Jsoup
  4.    .connect('http://www.filebot.net')
  5.    .get()
  6.  
  7. def links = page.select("A")
  8.     .collect{ [text: it.text(), link: it.attr('href')] }
  9.     .findAll{ it.text.length() > 0 && new URI(it.link).absolute }
  10.     .sort{ it.text.toLowerCase() }
  11.     .unique{ it.text.toLowerCase() }
  12.        
  13. links*.values()*.join(' -> ').join('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement