我应该使用哪个从网站 Google 应用引擎、计算引擎或云功能中抓取数据

Which should i use for scraping data from website Google appEngine, computeEngine or cloudFunctions

我想构建一个 nodejs 应用程序以每 20 分钟从网站抓取一次数据并将其存储在 firebase 中。你能告诉我google(计算引擎、应用引擎或云功能)的哪个产品对这个要求有效吗,如下是我期望做的事情, 1. 运行 Nodejs、cheerio 从网站抓取数据并存储在 firebase 中 2. 最初将其安排为 运行 20 分钟,之后可能会更改为 30 分钟或 1 小时。

阅读文档后,我知道实现这个的方法太多了,但我正在寻找一种 cost/resource 有效的方法。

建议和想法会很好。

在 App Engine 中托管 Node.js 应用程序[1] as Cloud Functions are event-driven[2]. You can use App Engine standard[3] or App Engine flexible[4] environment. For the scheduling part, Google Cloud Platform has a Cron Service[5] and you can create a cron job for your task hitting App Engine[6]. You can find a sample design here[7]

这取决于您的脚本花在等待请求上的时间。在此期间脚本处于空闲状态,但您会以超高的费率付费。

如果你正在做大量的并发,那么我会说用云函数来做。

这样做的另一个优点是你的 ip 不会被阻止,因为它每次都会不同时间.

关于调度,我不确定 Google 是否允许这样做,但我知道 AWS 可以。

成本 effective/simple 的方法是使用 cronjob.org 并让它向您的云函数 url 发送一个 http 请求来触发它。如果您担心其他人会触发它,请告诉您的 cronjob 发送带有 api 密钥的 http header。在您的云功能代码中检查此 api 键以验证 cronjob.org 发送了请求。我不认为它比这更多 easy/cheap。