node.js - 如何在 Node.JS 中获取 TargetingIdeaSelector API(用于获取关键字搜索数据的 Google API)?

标签 node.js

此 API 有其他语言版本,但我想要 Node.JS 中的代码。

最佳答案

来源:https://developers.google.com/adwords/api/docs/guides/targeting-idea-service#python_4

看起来你必须发送一个 POST 请求,问题是请求是从 targetingIdeaService.get function 构建的:

targetingIdeaService.get(selector)

选择器本身可以从文档中猜到:

offset = 0
PAGE_SIZE = 10
selector = {
    'ideaType': 'KEYWORD',
    'requestType': 'IDEAS',
    'requestedAttributeTypes':[
        'KEYWORD_TEXT',
        'SEARCH_VOLUME',
        'CATEGORY_PRODUCTS_AND_SERVICES'
     ],
     'paging':{
         'startIndex': str(offset),
         'numberResults': str(PAGE_SIZE)
     },
     'searchParameters':[{
         'xsi_type': 'RelatedToQuerySearchParameter',
         'queries': ['space cruise']
     }]
}

但是您无权访问从该对象构造请求的方式。

我建议您使用 this unofficial googleads node library因为它似乎可以处理 targetingIdeaService。甚至 this npm package因为它有更多的最新发展。

关于node.js - 如何在 Node.JS 中获取 TargetingIdeaSelector API(用于获取关键字搜索数据的 Google API)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62180861/

相关文章:

node.js - engine.io 和 socket.io 有什么区别?

javascript - 使用 cheerio 遍历 DOM - 如何获取所有元素及其对应的文本

node.js - 每个 axios 请求在 React-Redux 应用程序中都会触发两次?

node.js - 在 Linux 上安装 nodejs 和 npm

mysql - 将 web 套接字消息保存到 mysql 时如何防止数据丢失?

javascript - 将Java AES加密代码移植到node.js

node.js - 获取 NodeJS 的 Http 响应

javascript - 如何在 Raspberry Pi 和远程托管 Web App 之间建立双向通信?

mysql - 带有exress处理中间件外部数据库连接错误的Node.js

javascript 函数声明和作用域差异