Azoun
Azoun

Reputation: 255

Lua socket: why doesn't socket.http.request download entire html code of a page?

I want to download to a Lua string the entire html code of this web page. The problem is that the saved code skips some lines that are visible on Google Chrome when I use Inspect Elements command (right click on webpage, last option).

I need that lines because I want to use the informations written there, to be precise I want to catch the card prices.

The code used is simply:

-- loads the HTTP module and any libraries it requires
local http  = require("socket.http")

-- Lua socket --
b, c, h = http.request("http://magiccards.info/roe/en/4.html")
print(b)

How can I solve it?

Upvotes: 0

Views: 453

Answers (1)

Bartek Banachewicz
Bartek Banachewicz

Reputation: 39400

Probably some of the elements on the page are created after the main document loads, either by Javascript DOM operations, or AJAX queries which fill up the missing parts. You could look if these scripts are indeed downloaded and then run them locally using some embedded engine like V8.

Upvotes: 1

Related Questions