How to simulate browser?

User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

How to simulate browser?

Post by John »

That probably is the same HTML that both the browser and Vortex fetch, however the browser shows you the HTML after it has been updated with javascript, not what it actually received.
John Turnbull
Thunderstone Software
cpm18
Posts: 35
Joined: Mon Apr 13, 2009 3:21 pm

How to simulate browser?

Post by cpm18 »

Is it possible to get Vortex to process the javascript as the browser does?

I tried setting <urlcp javascript on> but that didn't seem to do it.
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

How to simulate browser?

Post by mark »

I don't know what the problem with the javascript is but you could extract the data by hand

<fetch ...>
<$html=$ret>
<$newhtml=$html>
<rex row 'id\="__w2_\P=[^_]+\F_datespan"' $html>
<$key=$ret>
<strfmt 'DateTimeComponent("%s", "", \\{"epoch_us": \\P=\\digit+\\F,' $key>
<rex $ret $html>
<if $ret ne ''>
<$when=(convert(convert($ret, 'double' )/1000000.0, 'dword' ))>
<$when=(convert($when, 'date' ))>
<strfmt '<span class\\="datetime" id\\="__w2_%s_datespan">Insert a dynamic date here</span>' $key>
<$s=$ret>
<strfmt '<span class="timestamp>%at</span>' '%I:%M%p %b %d' $when>
<$r=$ret>
<$newhtml=$ret>
</if>
</rex>
<!-- $newhtml has the HTML with date insertions -->
cpm18
Posts: 35
Joined: Mon Apr 13, 2009 3:21 pm

How to simulate browser?

Post by cpm18 »

This worked fine. I think I was overthinking the best way to solve this.
Post Reply