Python 我只想使用splash脚本并只返回作业列表';s URL

Python 我只想使用splash脚本并只返回作业列表';s URL,python,web-scraping,lua,scrapy,scrapy-splash,Python,Web Scraping,Lua,Scrapy,Scrapy Splash,我使用scrapy和splash来刮取网站,出于某些原因,我使用splash和scrapy,尽管我知道我可以刮取它的API。我的问题是,我只希望我的lua脚本只返回作业列表的URL,而不是整个splash:html()页面,我一直在尝试这样做,但我收到以下错误消息:- { "error": 400, "description": "Error happened while executing Lua script", "type": "ScriptError",

我使用scrapy和splash来刮取网站,出于某些原因,我使用splash和scrapy,尽管我知道我可以刮取它的API。我的问题是,我只希望我的lua脚本只返回作业列表的
URL
,而不是整个
splash:html()
页面,我一直在尝试这样做,但我收到以下错误消息:-

 {
    "error": 400,
    "description": "Error happened while executing Lua script",
    "type": "ScriptError",
    "info": {
        "message": "Lua error: /app/splash/lua_modules/libs/treat.lua:45: cannot change a protected metatable",
        "type": "LUA_ERROR"
    }
}
我一直在使用的lua脚本如下所示:-

function main(splash, args)
    assert(splash:go(args.url))
    splash:wait(5.0)
    local treat = require('treat')
    listings = assert(splash:select_all("ul.job_listings > li> a"))

    return {
       listing_urls = treat.as_array(listings)
    }

end
treat.as_array
尝试更改其参数的元表

导致此错误的原因是
列表
的元表设置了
\uu元表
字段

如果原始图元表具有_图元表字段,则会引发错误

treat.as_array
尝试更改其参数的元表

导致此错误的原因是
列表
的元表设置了
\uu元表
字段

如果原始图元表具有_图元表字段,则会引发错误

function treat.as_array(tbl)
  -- the same function is available in
  -- Splash Python code as lua._mark_table_as_array
  if type(tbl) ~= 'table' or wraputils.is_wrapped(tbl) then
    error('as_array argument must be a table', 2)
  end
  setmetatable(tbl, {__metatable="array"})
  return tbl
end