Skip to content
Advertisement

Java Web Scraper project is returning null instead of normal links

Used maven for htmlunit dependency for the webscraper. The main issue is that my scraper returns null instead of links. I made an item class to set and get.

JavaScript

}

Result: basically a line of null going down

*note: Putting System.out.println(link) returns one link and reuses that same link as it prints new line, in this case it would be just the link ‘https://sfbay.craigslist.org/sby/mob/d/san-jose-iphone-plus-256-gb-black/7482411084.html’ going all the way down

I’m a complete beginner in this cruel world. Any help is useful. edit: I’m going to include the dependency code here just in case, and the code for the Item class likely doesn’t need to be here as it is just a set and a get method outlined by setUrl and getUrl

JavaScript

Advertisement

Answer

This works here

JavaScript

producing something like

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement