Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.java.* > Newsgroup comp.lang.javascript

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-02-2007, 03:29 PM
Ben
Guest
 
Posts: n/a
Default how to get the values saved in variables?

Hi, I work like a robot today. My job is to visit a webpage, copy
several numbers, paste them to a text file. Then another webpage......
There are about 100 URLs. I decided to download all webpages and
process those files to extract the numbers.

I used a program called url2file to download webpages. However, the
numbers I need to extract are not there. I got something like

<script>document.write(v1)</script>

where v1 holds the number.

Is it possible to get the values in javascript variables without manual
work?

Thank you.

Ben

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 01-02-2007, 03:33 PM
Guillermo Rauch
Guest
 
Posts: n/a
Default Re: how to get the values saved in variables?

Ben wrote:
> Hi, I work like a robot today. My job is to visit a webpage, copy
> several numbers, paste them to a text file. Then another webpage......
> There are about 100 URLs. I decided to download all webpages and
> process those files to extract the numbers.
>
> I used a program called url2file to download webpages. However, the
> numbers I need to extract are not there. I got something like
>
> <script>document.write(v1)</script>
>
> where v1 holds the number.
>
> Is it possible to get the values in javascript variables without manual
> work?
>
> Thank you.
>
> Ben


I doubt you'll be able to get the numbers from javascript unless
they're stored in a variable, or maybe by redeclaring document.write().
Anyhow, in order to complete the task you mention automatically, I'd
recommend you to create a PHP/bash/perl/ruby/... script to parse each
file with a regular expression and get the value between ( ).

In that case, I guess you'll get more help in another list.

Best,
- Guillermo.

Reply With Quote
  #3 (permalink)  
Old 01-02-2007, 03:39 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: how to get the values saved in variables?

Ben wrote:

> I used a program called url2file to download webpages. However, the
> numbers I need to extract are not there. I got something like
>
> <script>document.write(v1)</script>
>
> where v1 holds the number.
>
> Is it possible to get the values in javascript variables without manual
> work?


IE on Windows can be automated with script so you could write a script
to fire up IE, load a URL, read out a value, load the next URL.

Another way might be to use HTTPUnit <http://www.httpunit.org/>.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Reply With Quote
  #4 (permalink)  
Old 01-02-2007, 03:49 PM
Ben
Guest
 
Posts: n/a
Default Re: how to get the values saved in variables?

I am working on a project to collect data from websites. Server side
scripting is impossible.

There's no problem if the data were returned in plain html files. For
javascript variables, Is there any way to simulate the web browser to
interpret the code in downloaded files so that we can add some code to
write the values out to a text file?

Guillermo Rauch wrote:
> Ben wrote:
> > Hi, I work like a robot today. My job is to visit a webpage, copy
> > several numbers, paste them to a text file. Then another webpage......
> > There are about 100 URLs. I decided to download all webpages and
> > process those files to extract the numbers.
> >
> > I used a program called url2file to download webpages. However, the
> > numbers I need to extract are not there. I got something like
> >
> > <script>document.write(v1)</script>
> >
> > where v1 holds the number.
> >
> > Is it possible to get the values in javascript variables without manual
> > work?
> >
> > Thank you.
> >
> > Ben

>
> I doubt you'll be able to get the numbers from javascript unless
> they're stored in a variable, or maybe by redeclaring document.write().
> Anyhow, in order to complete the task you mention automatically, I'd
> recommend you to create a PHP/bash/perl/ruby/... script to parse each
> file with a regular expression and get the value between ( ).
>
> In that case, I guess you'll get more help in another list.
>
> Best,
> - Guillermo.


Reply With Quote
  #5 (permalink)  
Old 01-02-2007, 04:41 PM
Ben
Guest
 
Posts: n/a
Default Re: how to get the values saved in variables?

> IE on Windows can be automated with script so you could write a script
> to fire up IE, load a URL, read out a value, load the next URL.


This is the way I am looking for. I searched IE automation and got tons
of links. Don't know which one is close to what I am looking for. Start
with MSDN forums...

Martin Honnen wrote:
> Ben wrote:
>
> > I used a program called url2file to download webpages. However, the
> > numbers I need to extract are not there. I got something like
> >
> > <script>document.write(v1)</script>
> >
> > where v1 holds the number.
> >
> > Is it possible to get the values in javascript variables without manual
> > work?

>
> IE on Windows can be automated with script so you could write a script
> to fire up IE, load a URL, read out a value, load the next URL.
>
> Another way might be to use HTTPUnit <http://www.httpunit.org/>.
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


Reply With Quote
  #6 (permalink)  
Old 01-02-2007, 05:38 PM
zero0x
Guest
 
Posts: n/a
Default Re: how to get the values saved in variables?

have you tried wget ?? it is very easy to use, and it can download
websites from list to one file.

On Jan 2, 5:29 pm, "Ben" <laser...@gmail.com> wrote:
> Hi, I work like a robot today. My job is to visit a webpage, copy
> several numbers, paste them to a text file. Then another webpage......
> There are about 100 URLs. I decided to download all webpages and
> process those files to extract the numbers.
>
> I used a program called url2file to download webpages. However, the
> numbers I need to extract are not there. I got something like
>
> <script>document.write(v1)</script>
>
> where v1 holds the number.
>
> Is it possible to get the values in javascript variables without manual
> work?
>
> Thank you.
>
> Ben


Reply With Quote
  #7 (permalink)  
Old 01-03-2007, 12:23 PM
Ted Zlatanov
Guest
 
Posts: n/a
Default Re: how to get the values saved in variables?

On 2 Jan 2007, laserbin@gmail.com wrote:

> Hi, I work like a robot today. My job is to visit a webpage, copy
> several numbers, paste them to a text file. Then another webpage......
> There are about 100 URLs. I decided to download all webpages and
> process those files to extract the numbers.
>
> I used a program called url2file to download webpages. However, the
> numbers I need to extract are not there. I got something like
>
> <script>document.write(v1)</script>
>
> where v1 holds the number.


This should work on most OSs:

curl URL | perl -ne'm/document\.write\((.*)\)/ && print "$1\n"'

It prints everything between the parenthesis of document.write(...)
and nothing else, separating the values with a newline.

If you are on Windows, you may want to try cygwin, which will let you
do the command above easily (as long as you've installed Perl and curl).

Ted
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Proc Format : Alpha Numeric???? Guido T Newsgroup comp.soft-sys.sas 0 04-21-2006 02:46 PM
Re: One of my reporting macros has 90 parameters - is that a record? David Newsgroup comp.soft-sys.sas 5 02-04-2006 03:07 AM
Re: Creating dummy variables automatically Dale McLerran Newsgroup comp.soft-sys.sas 2 01-09-2006 11:05 AM
Re: get count of unique values for all variables in a dataset Ian Whitlock Newsgroup comp.soft-sys.sas 0 10-08-2005 08:34 PM
Re: get count of unique values for all variables in a dataset Patnaik, Tirthankar Newsgroup comp.soft-sys.sas 0 10-08-2005 07:34 AM



All times are GMT. The time now is 07:28 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.