Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6079877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:59:47+00:00 2026-05-23T10:59:47+00:00

I have been using Jsoup to extract a a stock price from a stock

  • 0

I have been using Jsoup to extract a a stock price from a stock trading website. The stock price is updated automatically at regular intervals. I have tried using the examples given in the cookbook,,but have not been having any luck please help me out…

The following is what i have tried…

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;


public class sup {

    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        String url="http://money.rediff.com/companies/selan-exploratio/17020281";
        Document doc = Jsoup.connect(url).get();
        String quote = doc.select("#ltpid .f22 span").first().text();
        System.out.println(quote);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:59:48+00:00Added an answer on May 23, 2026 at 10:59 am

    The stock price seems to be stored in a span having the ID ltpid. Using the #ltpid selector is thus sufficient. Your selector tries to find a span which has an ancestor with the class .f22 which has an ancestor with the ID ltpid.

    Read http://jsoup.org/apidocs/org/jsoup/select/Selector.html for explanations about selectors.

    EDIT:

    You have a second problem though: this span is not inside the document you have loaded. It’s inside an iframe which has the following URL: http://money.rediff.com/money1/current_stat.php?companyCode=17020281.

    Try with this URL instead of the one you’re using, and it’ll work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using JSoup with android and so far I have been successful. In my
I have been using Jsoup for parsing my HTML files and so far it
I have been using the examples from this site ( http://dojotoolkit.org/documentation/tutorials/1.6/datagrid/ ) to render
I have been using PHP and JavaScript for building my dad's website. He wants
I have been using JSoup to parse lyrics and it has been great until
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a
I have been using play 1.2.5rc4 for development of one app and I have
I have been using an API to do some work. This is how I
I have been using some Javascript to create a text field once an certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.