登录并重定向到另一个页面

我对Splash不是很了解,但我想用它登录此网站,保留cookies,进入网站内的另一个url https://www.familysearch.org/search/record/results?count=20&offset=20&q.anyDate.from=1640&q.anyDate.to=1800&q.anyPlace=lima。 如您所见,这将为我节省大量时间,因为我可以仅更改url中的变量而不是在搜索查询中编写它们。

到目前为止,我已经成功登录并存储了cookies,但我不知道如何在重定向Splash到其他url时重新验证自己。

function main(splash,args)
    splash:set_viewport_size(1366, 768)
    splash:set_user_agent('Splash bot')
    assert(splash:go("https://ident.familysearch.org/cis-web/oauth2/v3/authorization?client_secret=bmBcR8ul1K8pBG%2BOgcC%2BoEiYqMKgoeTaydBo8jr0m7gsazpSwgrV6KfnIHzjd1POKT0x8ajM1QJHOweLL5HBzzGa%2BHk0fFA6sS93RRQo1k5Mb%2BlFxFXf72cXfybNd1PVV83VABTRk020u%2Buq3mIbReTwpVcxTJzymeFQ5bXpI6ZOsia1AiEmB1vf5pWZOYsPqUYWThOdMAwl3eXquRRCxZzSgJZuxInxnddtL12dFGSc8krYVi35HFW7F%2BTCMXQ%2FdAlRsnY3CyR50geRr6iyc%2BPVU%2Bw0A%2Br6meqGBAZk1oN%2FQPk8DKv9V1DzWpA5V5h4u3pLiLYlvDbzqBEsRGLKQw%3D%3D&response_type=code&redirect_uri=https%3A%2F%2Fwww.familysearch.org%2Fauth%2Ffamilysearch%2Fcallback&state=%2F&client_id=3Z3L-Z4GK-J7ZS-YT3Z-Q4KY-YN66-ZX5K-176R"))
    splash:wait(5)
    local form = splash: select('form[name=eventForm]')
        local values = {
            userName = 'username',
            password = 'password',
        }
    assert(form:fill(values))
    assert(form:submit())
    assert(splash:wait(10))
    cookies=splash:get_cookies()

    assert(splash:go("https://www.familysearch.org/search/record/results?count=20&q.anyDate.from=1500&q.anyDate.to=1650&q.anyPlace=Lima")) # 这一部分不起作用

    assert(splash:wait(10))

    return {
                  png = splash:png(),
                  cookies=splash:get_cookies() # 此处正确存储cookies
                }
end
点赞