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 7 1328
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.
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/
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.
Ben wrote on 02 jan 2007 in comp.lang.javascript :
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.
[....]
Is it possible to get the values in javascript variables without manual
work?
Certainly.
Storing the whole pages is not necessary.
Write a javascript programme for MS-Cscript or MS-Wscript, using the
var http = new ActiveXObject("Msxml2.XMLHTTP");
function getUrl(url) {
http.open("GET",url,false);
http.send();
return http.responseText;
};
and process the incoming string using Regex.
Multiple pages can be searched in one go.
You can even append the resulting string values to a local file adding date
time stamps on the go, as you are not restricted by browser security.
You could skedule such little programme as a dayly task and go on holyday
into a non internetted area for a month, telling your neighbor how to rest
the pc after a crash.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
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/
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.comwrote:
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
On 2 Jan 2007, la******@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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jack |
last post by:
Hi,
I have the following problem.
I have a main data entry form which has a link to a detailed data entry
form. The value of the link in the main form is the sum total of all the
line items...
|
by: deko |
last post by:
I have a number of variables that need to be saved for later use. For
example, the path to be used for exporting files, options for creating
reports, interface preferences, saved search...
|
by: LionsDome |
last post by:
Hello,
I have a vb.net page which a bunch of checkboxes. A user can select a
checkbox(s) and hit the submit button to store those values in a SQL
Server table. This works fine with no problem...
|
by: rezme |
last post by:
Allow me to preface this with a disclaimer: I'm self taught in C#, basically I type code in from what I've found on the web, and try to get it to do what I want it to. I'm sure there's a lot of us...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |