Created
October 18, 2014 09:01
-
-
Save wololock/1a002dfaff5d49d14871 to your computer and use it in GitHub Desktop.
Jsoup and ignoring HTTP errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jsoup.Jsoup | |
import org.jsoup.nodes.Document | |
@Grab(group='org.jsoup', module='jsoup', version='1.8.1') | |
String url = 'http://tomfishburne.com/2014/09/socialmedia.html' | |
Document document = Jsoup.connect(url) | |
.userAgent('Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0') | |
.ignoreHttpErrors(true) | |
.get() | |
assert document.body() =~ 'Tom Fishburne: Marketoonist' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment