Can I extract information from a webpage that is generated by javascript?

I am trying to keep a track of the number of a forum's online viewer such as this website
http://club.chinaren.com/The online viewer number is placed at the left top area as �������� (misdisplayed Chinese characters) [number]���� which means "Currently online: [number] people"
I checked its html source and find it was generated by javascript as
<div class="cr1bg">������<span> <script>getTotalBoardUser()</script></span>��</div></div></div></div>After I saved the webpage to my local disk, I found the getTotalBoardUser() defintion in a .js file named club_olusers.js like:
totalBoardUsers = 23565;
function getTotalBoardUser() {
     document.write(totalBoardUsers);
}Now I want to extract the totalBoardUsers value.
Is it possible? How to do that?
Thanks!
Edited by: aaron9979215 on Jun 15, 2008 2:18 AM

Here's a way:
import java.io.*;
import java.net.*;
import java.util.*;
public class Test {
    public static void main(String[] args) throws MalformedURLException, IOException {
        String url = "http://club.chinaren.com/club_olusers.js";
        Scanner jsFile = new Scanner(new URL(url).openStream());
        while(jsFile.hasNextLine()) {
            String line = jsFile.nextLine().trim();
            if(line.matches("totalBoardUsers\\s+=\\s+\\d+;")) {
                System.out.println(line.replaceAll("[^\\d]+", ""));
                break;
}

Similar Messages

  • How can I extract information from a web page

    I wanna read some information from a webpage, and then put those information together into a table. Since I only know the url, not the file path, when I use BufferedReader(new FileReader(FilePath)), there is a FileNotFoundException. How can I do that? Thanks a lot.

    You can do it in following way....
    First you need to create the object of URL by specifying the URL name.
    URL myurl = new URL("http://www.xyz.com/index.html"); //specify your URL path here
    URLConnection conn = null;
    DataInputStream data = null;
    String line;
    StringBuffer buf = new StringBuffer();
    try {
    conn = myurl.openConnection();
    conn.connect();
    data = new DataInputStream(new BufferedInputStream(
    conn.getInputStream()));
    while ((line = data.readLine()) != null) {
    buf.append(line + "\n");
    data.close();
    catch (IOException e) {
    System.out.println("IO Error:" + e.getMessage());
    So, at the end, you have the data in your string buffer...you can use it wherever u want.
    Hope this helps

  • Can I extract information from HD while in grey screen?

    Okay, I am stuck on Grey screen with apple. Then it shuts down. No, I do not have a back up. I thought this worked like my iPhone and iPad where everything is saved. Silly me. Is there anyway that I can get the information from my laptop now?

    Connect it to another Mac with a FireWire or Thunderbolt cable and start up your computer with the T key held down. You may need to use a disk repair or data recovery product to get at the files.
    (103901)

  • How can I extract information from an IdM approval stack?

    During the workflow for provisioning employees, managers are required to authorize certain actions. The problem is that they sometimes do not.
    My boss has asked for a formatted report in ascending date order that shows the passive authorizations (some are weeks old!) and the managers to whom the "lazy" managers report.
    I've done this, but it's driven by my manually screen-scraping the information from the approval list onto an external file.
    The problem is that I have to initiate the process by bringing up the approval screen, copying and pasting information into a file and then running a Perl munge script against the created file...
    I want to be able to acccess the approvals list by means of a crontab initiated script and not have to rely on the "screen-scrape."
    Any ideas?
    Ian Clark
    ADP - ProBusiness.
    Message was edited by:
    Namalankula

    You can do it in following way....
    First you need to create the object of URL by specifying the URL name.
    URL myurl = new URL("http://www.xyz.com/index.html"); //specify your URL path here
    URLConnection conn = null;
    DataInputStream data = null;
    String line;
    StringBuffer buf = new StringBuffer();
    try {
    conn = myurl.openConnection();
    conn.connect();
    data = new DataInputStream(new BufferedInputStream(
    conn.getInputStream()));
    while ((line = data.readLine()) != null) {
    buf.append(line + "\n");
    data.close();
    catch (IOException e) {
    System.out.println("IO Error:" + e.getMessage());
    So, at the end, you have the data in your string buffer...you can use it wherever u want.
    Hope this helps

  • How can I take text from a webpage that is in multiple rows and move it into a single row in Excel?

    I need help figuring out how to take data from internet pages and enter it into one single row in an excel, or numbers if that is the easier way to go.  I was also told access might be good to use.  Basically I am going to chamber of commerce page and wanting to extract the member listing and enter in a database in a single line.  The  data is in different numbers of lines as you will see below (info edited to take out personal info). So I want to take the  name of business, business owner, address, city, state, zip, and phone and put it into one line on a spreadsheet.  I want to do this many times over. I think there is a way to do it through apple script and automator, but I have not been successful after 2 weeks of trying and searching.  I have over 800 listings and I surely don't want to go through and do them one at a time.  Any suggestions?
    Data from website:
    Westrock Coffee
    Mr.
    Collins Industrial Place
    North Little Rock, AR 72113
    Phone:
    Send Email
    Member Since: 2011
    Sweet Creations by DJ
    Ms. J
    allace Bridge Road
    Perryville, AR 72126
    Phone:
    Fax:
    Send Email
    Member Since: 2013
    See Also Woman Owned and/or CEO
    Premium Refreshment Service
    Mr. E
    est Bethany Road
    North , AR 72117
    I want it to look like this
    Company name, owner name, address, city, state, zip, phone
    How can I get the extra data out of the way and remove the format so that it will go into excel?  Thanks for any help you can provide.  I am not to savvy with code, but I got a friend who is an IT guy that can help.  Thanks again

    So, basically, create 800 individual entries, each one containing everything from business name through the phone (not fax) number, add some commas and spaces to entries, and then put each entry on a separate line?
    1. Go to website page such as this one-- http://www.littlerockchamber.com/CWT/External/WCPages/WCDirectory/Directory.aspx ?ACTION=newmembers --which seems formatwise very close to what you're trying to scrape.
    2. Cmd-A to select all. Cmd-C to copy it to clipboard.
    3. Open freeware TextWrangler. Cmd-V to paste info from clipboard into a blank TW document.
    4. Remove lines from top and bottom so that only membership list remains.
    5. Process lines to remove everything from "Fax" line through "See Also" line. Only business name through phone number will remain in the file.
    --A. TW > Text > Process Lines containing . . .
    -----(check "Delete matched lines"; uncheck all others)
    -----Enter "Send Email" in the search box.
    -----Click Process.
    --B. Repeat 5A for other lines to be removed
    ------Member Since
    ------See Also
    ------Fax
    6. Insert markers to separate entries:
    TW: Search > Find . . .
    ------(check "Wrap around" and "Grep")
    ------in Find box: \r\r\r\r
    ------in replace box: \r***
    ------Click Replace All
    7. Remove remaining blank lines:
    TW: Search > Find . . .
    ------(check "Wrap around" and "Grep")
    ------in Find box: \r\r
    ------in replace box: \r
    ------Click Replace All
    8. Add comma and space at end of each line:
    TW: Search > Find . . .
    ------(check "Wrap around" and "Grep")
    ------in Find box: $
    ------in replace box: ,  (comma space)
    ------Click Replace All
    9. Remove all returns:
    TW: Search > Find . . .
    ------(check "Wrap around" and "Grep")
    ------in Find box: \r
    ------in replace box: (leave blank)
    ------Click Replace All
    10. Insert returns in place of markers:
    TW: Search > Find . . .
    ------(check "Wrap around" and "Grep")
    ------in Find box: \*\*\*,  (backslash asterisk backslash asterisk backslash asterisk comma space)
    ------in replace box: \r
    ------Click Replace All
    11. Remove trailing comma and blank on each line:
    TW: Search > Find . . .
    ------(check "Wrap around" and "Grep")
    ------in Find box: , $ (comma space dollar sign)
    ------in replace box: (leave blank)
    ------Click Replace All
    Import this text file into Excel or Numbers.

  • Can you get information from an iPhone that has been remote wiped?

    Hello,
    My girlfriend thought her iPhone was stolen today, so she did a remote wipe so no one could steal her information off her phone.  It ended up that she had just left her iPhone someplace and was able to get it back. 
    Now that she's got the phone back, she's trying to restore it, but it looks like the iPhone was set to back up to iCloud, but never did because of an error (she had no idea she was getting), and it seems that since it was set up to back up to iCloud, the last iTunes backup was from before she got her iPhone 4s (so it's 5 months old).
    Is there anyway to pull information off of an iPhone after it's been remote wiped?  I have a program for pulling information off of digital camera memory cards that have been formatted.  Is there something like this for iPhones?
    Thanks,

    tkeets wrote:
    Is there anyway to pull information off of an iPhone after it's been remote wiped? 
    Sorry, no. Her data is gone, as designed.

  • Programatically extract information from PDF

    I am very green to Adobe/Java programming, so this is just a plausibility question not really a how to question.  Is it possible to take text from a PDF document that isn't a form?  I have heard about  database integration with forms  but what if the document doesn't have recoginzed fields?
    The department of labor has an online form that prints to PDF.  Much of the information that is typed there must be re-typed over and over again in communications with employers.  I'm wondering if we could take the information from the PDF and put it in a database to be merged in our office-created forms.
    Sorry if my question is totally out there and thanks for any help.

    I am scadoosh, but not iluvtofly.  The information is in the same place in the forms. I could send the form if that is helpful.  It is a form that we have to fill and submit online.  We were hoping we could implement a solution where we could either extract information from the form that has been "printed to pdf" or the opposite, where we would fill in a database and programmatically fill the form.
    When you say an Adobe LiveCycle product, what is that?  Is it software or hardware?  Would we have to purchase something in addition to Adobe Acrobat?  What do we need to implement such a solution?
    Are there Adobe people who design custom products?  Or could we get training somewhere on how to implement an Adobe LiveCycle solution.  If there are custom designers,  could they implement a solution so that if the government moved fields a little bit, we could adjust the LiveCycle solution to fit the new form.
    Thanks!

  • HT3275 how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    Plug an external drive into the computer and use that to expand data onto.
    http://pondini.org/TM/16.html

  • HT1766 How can I bring back the information from an application that was mistakenly deleted?

    How can I bring back the information from an application that was mistakenly deleted?

    Only if you backed up the phone before that and did not back up after that. App settings and data are part of the backup. But all other data will be set back as well, you can't choose a single app to be restored from the backup.

  • Extracting information from a table based on different criteria

    Post Author: shineysideup
    CA Forum: Formula
    Hi Folks
    I have a bit of a strange one here.
    I need to extract information from a single table based on different critera.
    Sounds simple enough but here's the tricky part.
    This table is a table that contains the build of a product. All the parts that are used to make the product and also the sub-parts that are used to make the primary product parts.
    Example:
    I have a part that is in the product and the part no is 1111. This part is actually part of another part that is part no 1112
    What I need to do is display part no 1111 with all of its details but then also show that it is also part of part no 1112.
    The way the table holds this information is as follows.
    Seq_No      Parent_Seq_No     Part_No
    The seq_no is item no that is given to the part number. If the part is a member of another part then there is also a parent_seq_no.
    Everything needs to tie back to the seq_no and the parent_seq no as the part itself can be used in a parent or it can be used on its own. This way you can actually have the same part appearing in the list several times but the seq_no will be different for each one. If the part can be used in two different sub-builds (with each part being used twice in each sub-build) and also on its own once then you would have 5 different seq_nos two parent_seq_nos.
    What I need to do is to list all of the parts but then also when a part is part of a parent_seq_no I need to be able to display the parent seqno but also the part_no for that as the parent would also be listed as an individual item in the part list.
    At the moment listing the part_no, seq_no and parent_seq_no is easy but when I try to list the part_no for the parent I jsut keep getting the original sub part again. I can do this with a sub-report but with what I need to do with the data after listing the parts a sub-report is not an option for me.
    This make sense?
    Thanks

    Post Author: Charliy
    CA Forum: Formula
    As long as the chain only goes one link deep, you should be able to Alias the table and link it (left outer)  from the child part to the parent part.  Then build a Detail B (or Group Footer if that's where you're printing) and conditionally suppress is if there is no "Parent Part".

  • How can I transfer information from one ipad to another?

    how can I transfer information from one ipad to another ?

    What kind of information? You can sync things like Contacts and Calendars by using iCloud. You can backup one iPad to iTunes on a computer and then sync the backup to the other iPad. You can configure your iTunes content and sync the same content to both iPads.
    It is based on what you want to do. Or are you looking for a way to send files from one iPad to another wirelessly? There are apps to do things like that, as well as cloud services, such as DropBox.

  • HT201250 how can i pass information from one mac to another mac by using the time capsule

    how can i pass information from one mac to another mac by using the time capsule

    If you want to transfer files, settings, etc., you must open Migration Assistant (Applications > Utilities) in the Mac that you want to transfer the files and follow the instructions

  • Can I extract data from an ABAP connector?

    Hello!
    Can I extract data from an ABAP connector and write on a file or I have to write before on an Oracle table?
    Thanks in advance

    If you are using the ODI ABAP knowledge modules, if you inspect the LKM SAP ABAP to Oracle, you will see that it does load a file into Oracle. You could tailor these to stop after creating the file. Otherwise, if you need to do some manipulation, you could load into tables in Oracle before extracting to file.

  • Can I extract metadata from planning or only from essbase?

    Hi!
    Can I extract metadata from planning or only for essbase? If I can from planning, how can I do it? And why when I extract metadata from essbase, it extract the members that are never share in Store? It always put S (Stored) .
    Thanks in advance.
    Bye

    Hi,
    You can only extract metadata from essbase, if you want to have a look at some examples of how to do it then have a read here
    Ok?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to extract information from client security certificates and display it

    Hi guys,
    just wanted to know is it possible to extract information from an digital security certificate and get that displayed on top level navigation of the portal. So for ex. I want to extract the clients name and code and area from where they come from to be displayed on top level.
    thanks
    anton

    RoopeshV wrote:
    Hi,
    The below code shows how to read from txt file and display in the perticular fields.
    Why have you used waveform?
    Regards,
    Roopesh
    There are so many things wrong with this VI, I'm not even sure where to start.
    Hard-coding paths that point to your user folder on the block diagram. What if somebody else tries to run it? They'll get an error. What if somebody tries to run this on Windows 7? They'll get an error. What if somebody tries to run this on a Mac or Linux? They'll get an error.
    Not using Read From Spreadsheet File.
    Use of local variables to populate an array.
    Cannot insert values into an empty array.
    What if there's a line missing from the text file? Now your data will not line up. Your case structure does handle this.
    Also, how does this answer the poster's question?

Maybe you are looking for

  • Windows 8.1/Server 2012 R2 Exams - EFFECTIVE DATE ADJUSTED!

    Hi, everyone. Microsoft has adjusted the effective starting date of when the Windows 8.0 exams and Windows Server 2012 exams will be updated to Windows 8.1 and Windows Server 2012 R2 at Prometric. The new effective date is January 28, 2014. This mean

  • Internal table - work area not long enough

    Subject changed by moderator.  Please try to use a more meaningful subject in future The work area "ITAB" is not long enough. how to solve this problem. Edited by: Matt on Nov 14, 2008 10:20 AM

  • Cannot use Landed Cost if GRN PO has partial Goods Return

    Dear Experts, I'm using SAP B1 2005. I met a problem whereby the GRN PO cannot be used in Landed Cost if one of the items has done the Goods Return, eventhough the GRN PO status is still 'Open'. 1) Create GRN PO with 2 items. 2) Goods Return on 1 of

  • Alternative solution to MA

    This is a bit of rant/question. I have purchased a new iMac 27". Current iMac 24 has some issues with permissions, fonts, and other issues related to specific programs. It was time for me to buy a new Mac anyway so I figured that I would not try to s

  • Advanced printer settings

    In the advanced printing option I can choose if I want to turn gray scale off and use blank ink cartrige only. How do I make this the default?????? I only want to print out in black and not always have to go in and change this setting each print job.