Why my splash:select always fail in this simple code (Splash)? - web-scraping

I want to select the "2nd-page" button at the end of this website using Splash code (Docker/Browser ver).
I even used the "copy Selector" function of Chrome to get to the extract part, I also checked with F12 and CtrlF and found the extract position. But somehow my code still fail at the select function
Below is my simple Lua Splash code:
function main(splash, args)
splash.private_mode_enabled = false
url = args.url
assert(splash:go(url))
assert(splash:wait(1))
next_page = assert(splash:select('div > div.py20 > div > nav > ul > li:nth-child(3) > a'))
assert(splash:wait(1))
next_page:mouse_click()
return {splash:html()}
end
My code always fails at the next_page line with an assertion error:
{
"error": 400,
"type": "ScriptError",
"description": "Error happened while executing Lua script",
"info": {
"source": "[string \"function main(splash, args)\r...\"]",
"line_number": 8,
"error": "assertion failed!",
"type": "LUA_ERROR",
"message": "Lua error: [string \"function main(splash, args)\r...\"]:8: assertion failed!"
}
}

Related

Executing mutliple requests does not work in Make.com

I want to run mutliple requests in a single module, just like here https://docs.integromat.com/apps/app-blocks/api/multiple-requests
The issue is, the first URL is never called, only a second one and the temp variable is null. When I remove second URL the first one is called properly, could you guys please advise?
Here is the code, one of my tests but no matter what I do, first line is not executed, temp var is null. When I comment out second URL the first one is executed properly.
[
{
"url": "/users/{{parameters.clientID}}/conversations/",
"response": {
"temp": {
"conversationID": "{{body.results}}"
}
},
"url": "/conversations/{{temp.conversationID.1.id}}/",
"response": {
"output": "{{body.results}}"
}
}
]
Thanks!

Q: Google Calendar API, Foreground color

I am currently working with the google calendar API and and have ran into an issue.
I can't seem to update (or patch) a calendarList's foreground color.
Even when working directly with their API at:
https://developers.google.com/calendar/v3/reference/calendarList/patch
With both queries, I have colorRgbFormat set to true, and these are the only values I provide.
This input works fine:
{
"backgroundColor": "#ac725e"
}
Where this input:
{
"backgroundColor": "#ac725e",
"foregroundColor": "#c1c1c1"
}
Gives me the following error:
400 bad request:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid foreground color."
}
],
"code": 400,
"message": "Invalid foreground color."
}
}
Any ideas?
I have tried using similar color format that is needed for ColorId, AKA "1", but that also gives me a bad request error.
What am I missing or doing wrong?
After doing trial and error, I found out that the foregroundColor is limited only to black(#000000) and white (#FFFFFF).
Example:
Reference:
CalendarList

AppSync BatchDeleteItem not executes properly

I'm working on a React Native application with AppSync, and following is my schema to the problem:
type JoineeDeletedConnection {
items: [Joinee]
nextToken: String
}
type Mutation {
deleteJoinee(ids: [ID!]): [Joinee]
}
In 'request mapping template' to resolver to deleteJoinee, I have following (following the tutorial from https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-dynamodb-batch.html):
#set($ids = [])
#foreach($id in ${ctx.args.ids})
#set($map = {})
$util.qr($map.put("id", $util.dynamodb.toString($id)))
$util.qr($ids.add($map))
#end
{
"version" : "2018-05-29",
"operation" : "BatchDeleteItem",
"tables" : {
"JoineesTable": $util.toJson($ids)
}
}
..and in 'response mapping template' to the resolver,
$util.toJson($ctx.result.data.JoineesTable)
The problem is, when I ran the query, I got empty result and nothing deleted to database as well:
// calling the query
mutation DeleteJoinee {
deleteJoinee(ids: ["xxxx", "xxxx"])
{
id
}
}
// returns
{
"data": {
"deleteJoinee": [
null
]
}
}
I finally able to solve this puzzle, thanks to the answer mentioned here to point me to some direction.
Although, I noticed that JoineesTable does have trusted entity/role to the IAM 'Roles' section, yet it wasn't working for some reason. Looking into this more, I noticed that the existing policy had following actions as default:
"Action": [
"dynamodb:DeleteItem",
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query",
"dynamodb:Scan",
"dynamodb:UpdateItem"
]
Once I added following two more actions to the list, things have started working:
"dynamodb:BatchWriteItem",
"dynamodb:BatchGetItem"
Thanks to #Vasileios Lekakis and #Ionut Trestian on this appSync quest )

How to use $filter for birthday filed in microsoft graph?

I have tried like below
https://graph.microsoft.com/beta/me/people?$select=displayName,birthday&$count=true&$top=100&$filter=birthday eq '2017-03-14'
But i am getting an error like below
{
"error": {
"code": "ErrorInvalidProperty",
"message": "The property 'Birthday' does not support filtering.",
"innerError": {
"request-id": "79316157-c634-4b61-82f9-f6920370538f",
"date": "2017-06-23T08:46:32"
}
}
}
Any idea ?
You can't filter on the birthday field.
The documentation lists for each resource lists which properties support $filter. For user the list is at https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties.

Application of mqlread cursor leads to non-unique error

This is a freebase mqlread query to get some id's about each film.
https://www.googleapis.com/freebase/v1/mqlread?query=[{ "name": null, "mid": null, "type": "/film/film", "/film/film/rottentomatoes_id": null, "/film/film/imdb_id": null }]&cursor
That works and returns this cursor.
=eNpVjMEKwjAQRH9HkdDZsNlNFhH_I_QQYgsFsdKgR7_dIII4lxlmmFcfW1s3oyKT5dUIGPOtm3pETiGMSysG9y1U2a5Ht3sudyMNGgXxtwXbDsnDl1jBAIRpjvhTdafPD6L7gRI6gezlcus8yDicRaYLMc9Qrkm5x8B4A72MKIs=
My problem is the subsequent call formulated by appending the cursor value which does not work. See below.
https://www.googleapis.com/freebase/v1/mqlread?query=[{ "name": null, "mid": null, "type": "/film/film", "/film/film/rottentomatoes_id": null, "/film/film/imdb_id": null }]&cursor=eNpVjMEKwjAQRH9HkdDZsNlNFhH_I_QQYgsFsdKgR7_dIII4lxlmmFcfW1s3oyKT5dUIGPOtm3pETiGMSysG9y1U2a5Ht3sudyMNGgXxtwXbDsnDl1jBAIRpjvhTdafPD6L7gRI6gezlcus8yDicRaYLMc9Qrkm5x8B4A72MKIs=
This gives
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "query is invalid: JSON parsing error.",
"locationType": "other",
"location": "parameters.query"
}
],
"code": 400,
"message": "query is invalid: JSON parsing error."
}
}
but all thats changed is the appendage of the cursor value.
Why would I get this sort of error in the circumstance and how would I fix it.
Some of your properties aren't unique. If you get only one value back, the query will work fine, but as soon as you hit a topic with multiple values, you'll get a non-unique error like this:
error: {
errors: [
{
domain: "global",
reason: "invalid",
message: "Unique query may have at most one result. Got 2",
locationType: "other",
location: "/film/film/rottentomatoes_id"
}
],
code: 400,
message: "Unique query may have at most one result. Got 2"
}
The error message is pretty specific. The offending property is the one for Rotten Tomatoes ID. If you switch your placeholder value from "null" to [] for this property to accommodate multiple values, the query will work.

Resources