我想调用 Apify 演员并通过调用 Apify API 来指定参数值。
演员是位于此处的 Google Search Results Scraper。
这是文档说用作queries
API 调用有效负载中的对象属性名称的地方。
下表显示了由其输入模式定义的参与者 INPUT 字段的规范。当使用 API 运行 actor 时,可以 [...] 在 JSON 对象中提供这些字段。在文档中阅读更多内容。
...
搜索查询或 URL
Google 搜索查询(例如纽约市的食物)和/或完整 URL(例如https://www.google.com/search?q=food+NYC)。
每行输入一项。
可选
JSON 示例
类型:字符串"queries": "Hotels in NYC Restaurants in NYC https://www.google.com/search?q=restaurants+in+NYC"
运行我的 Google Apps 脚本代码后,我希望看到searchQueries.term
参数发生如下变化。
"searchQuery": {
"term": "Banks in Phoenix", // what I am trying to change to by API call
// [...]
},
但我实际得到的是与上次手动运行actor时相同的参数值。如下。
Apify——我实际看到的"searchQuery": {
"term": "CPA firms in Newark", // remaining from last time I ran the actor manually
// [...]
},
这是我从 Google Apps 脚本运行的代码。
代码.gsconst runSearch = () => {
const apiEndpoint= `https://api.apify.com/v2/actor-tasks/<MY-TASK-NAME>/run-sync?token=<MY-TOKEN>`
const formData = {
method: 'post',
queries: 'Banks in Phoenix',
};
const options = {
body: formData,
headers: {
'Content-Type': 'application/json',
},
};
UrlFetchApp.fetch(apiEndpoint, options,);
}
我究竟做错了什么?