Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Oct 2010
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    pulling plain text from a website, how?

    Ok, so basically i am just trying to pull plain text from a website. basically it will display a person's Runescape stat's in text form.

    here is my code so far on how to get the url for the page.

    Code:
     private void statsButtonActionPerformed(java.awt.event.ActionEvent evt) {
           String oldrsn = rsnTextField.getText();
           String newrsn = null;
           String statPuller = null;
           for (int i = 0; i < oldrsn.length(); i++) {
               newrsn = oldrsn.replaceAll(" ", "_");
           }
           statPuller = "http://hiscore.runescape.com/index_lite.ws?player=" + newrsn;
           
    
        }
    basically, that does is combine the person's gamer name along with the correct url to access their stats

    So, for example, if I wanted to get the user "Elite Clues", this code would make the url http://hiscore.runescape.com/index_l...er=Elite_Clues I would then want his/her data in my Java program

    And that url page for "Elite Clues" displays this:
    (you can just pop that link into the url to see yourself)
    254223,1730,41252224 181358,92,7018183 175673,90,5347709 241135,94,7962470 238717,92,6674838 617607,75,1264987 234511,70,757728 560087,76,1402988 595779,74,1101241 -1,-1,-1 1084258,60,295003 412654,78,1659647 456400,70,790204 421026,63,386483 337367,65,485600 967287,64,426256 294510,57,222206 427295,58,231120 329460,61,315285 121978,81,2303119 271763,57,204005 512900,50,110160 420812,62,336172 179464,67,552157 118258,74,1099187 319783,41,45061 -1,-1 -1,-1 -1,-1 211063,1383 -1,-1 56327,1467 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1

    So I am trying to find a way to pull that data from a url into my program.
    I can parse it and sort it from there on my own.
    Thank you,
    -Austin

  • #2
    New Coder
    Join Date
    Feb 2011
    Posts
    48
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Here is a demo Java web crawler project, this may help you.

  • #3
    New Coder
    Join Date
    Oct 2010
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DistantJob View Post
    Here is a demo Java web crawler project, this may help you.
    way too much coding in there.

    I'm sure that there is some sort of reader/scanner setup where I can just read the text on the web page.

  • #4
    New Coder
    Join Date
    Feb 2011
    Posts
    48
    Thanks
    1
    Thanked 2 Times in 2 Posts
    The given code gives you answers to many questions, and, if you're only interested in a part of the code you can just study that part. "way too much coding in there" is not an answer. It means you are lazy to study the part which is relevant for you and contains the solution for your question. So, either google for a solution, study the given code or wait for the answer of other people. These are the polite approaches for somebody who asks a question, not something like "this is not good, because I'm lazy to check it".

  • #5
    Regular Coder
    Join Date
    Feb 2008
    Location
    Edinburgh - Scotland
    Posts
    107
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Try looking at the URL/URLConnection object and the Apache HTTPClient - there is an example of the use of the URL object's in the post from DistantJob


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •