This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

JSoup Extracting Data

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,


I am trying to extract a price from a website using jsoup, the span id = xidn-50654-lastprice below. I have already successfully logged in using JSoup but stuck now.




I have tried many different variations and have been able to extract data from the likes of wikipedia ok. However this span id is driving me a bit mad.

Here is my latest attempt, others are in comments plus many others.

I can do it through Selenium no bother but we use JSoup in work (guy who knows about this stuff here is on hols) so better to do my practice through this.



The website I am using is a shareprice website. I am interested in stocks and shares, so thought it would be more fun to learn in through things I like.

Thanks,

Pete
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quite often in that kind of site you have to sign in before you get to see the full content. That involves multiple pages and cookies being passed around.

Your code isn't doing that so probably it is getting a login page or an access refused page.
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!