1

------------ORIGINAL QUESTION------------------

In my Splash Script, I am trying to use "splash:go" on a new url that is based on the "src" attribute of an "img" tag. How can I access this "src" relative url and join it to a start_url?

For example, imagine that the img element has the following contents:

<img id="ImageViewer1_docImage" onload="BlockerResize('ImageViewer1_ContentBlocker1','ImageViewer1_WaterMarkImage');" src="ACSResource.axd?SCTTYPE=ENCRYPTED&SCTKEY=gMYed5OWqcT9I1Y2fM85DvB48X5U1DQ5mOUiJoUH4rioyau0nJdxt0PHFfGVTMiUsork/YD+Cw0F6ZzcviP4sG09xrqWM8/zJlyEeVRFkKXVnkyHYWgwNJzCSUE4Kh4yCsqw6mCuIxWxPj6BAI7Hbw==&CNTWIDTH=849&CNTHEIGHT=684&FITTYPE=Height&ZOOM=1" alt="Please wait" style="border-width:0px;cursor: url(images/Cursors/hmove.cur); z-index: 1000">

Here I am trying to extract the src attribute and add it to start_url:

https://i2a.uslandrecords.com/ME/Cumberland/D/

I want all of this inside the Splash script. I need it to be done inside of Splash because otherwise I lose my security/encryption or something--it renders "Bad Data" instead of the new webpage. Do you have any recommendations?

------------UPDATE------------------

So I managed to obtain the url I needed from the src attribute using the following code:

var = splash:evaljs("document.getElementById('ImageViewer1_docImage').src;")
splash:go(var)  

However, the problem is that this is producing a error message. All I find in the snapshot is a white page with the following message:

Failed loading page (Frame load interrupted by policy change)

https://i2a.uslandrecords.com/ME/Cumberland/D/ACSResource.axd?SCTTYPE=ENCRYPTED&SCTKEY=gMYed5OWqcSvEWOJA6wGVmb642s2oZHqkYmT6VTpORTzMY7CgvDU5jsjJG/xp0X3eQ9BiDnbaTdAmISeLkC3hyjxGjcSnXOKgGDa8cI2fniY0ILT+NqvQToMGIB+/X3ZIs7Q+D4ppTSZGYZ2L4M/

Webkit error #102

Any idea why?

ta_duke
  • 49
  • 1
  • 8

2 Answers2

0

The image src attribute is exactly the URL you need to access or as stated by the question title you need to append it to some other URL parts?

If that is the case, you can do it by '..'

Ex.: splash:go(base_url..var) -- concatenation

0

ISSUE RESOLVED:

Here is the solution. The GET request was breaking down because it didn't know how to render the image in html given the webkit settings. If you execute the GET request without rendering the page, the response.body has the image.

CODE:

local response = splash:http_get(var)
    return {
    body = response.body
    }
ta_duke
  • 49
  • 1
  • 8