从自动创建的事件访问事件描述 - Google 日历 API

Accessing event description from automatically created event - Google Calendar API

对于我的项目,我试图从用户的 Google 日历中提取航班预订信息。

我需要的关键信息是航班确认号,它存储在活动的描述中。

calendar preview

这是事件的响应:get

   "kind": "calendar#event",
   "etag": "\"3043267198652000\"",
   "id": "_6tlnaq...o6e",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=XzZ0...QG0",
   "created": "2018-03-07T00:12:22.000Z",
   "updated": "2018-04-04T23:47:36.112Z",
   "summary": "Flight to Sydney (PX 1)",
   "description": "To see detailed information for automatically created events like this one, use the official Google Calendar app. https://g.co/calendar",
   "location": "Port Moresby POM",
   "creator": {
    "email": "inceptable@gmail.com",
    "self": true
   },
   "organizer": {
    "email": "unknownorganizer@calendar.google.com"
   },
   "start": {
    "dateTime": "2018-04-21T15:00:00+10:00"
   },
   "end": {
    "dateTime": "2018-04-21T18:55:00+10:00"
   }

此事件的描述已替换为此消息:

"To see detailed information for automatically created events like this one, use the official Google Calendar app. https://g.co/calendar"

我一直无法找到关于为什么会发生这种情况的任何信息。

Forum post with same problem

我的解决方法是使用 Gmail API 阅读用户的电子邮件并使用正则表达式提取航班确认号码。

这不是可取的,因为它容易出错并且需要用户的许可才能阅读他们的电子邮件。 我宁愿让 Google 提取这些信息,因为他们已经在这样做了。

是否可以从自动创建的事件中访问此信息? 如果不是,为什么 Google 限制此信息?

您需要了解 Google 日历 API 只能显示它拥有的信息。相关事件的描述是

"To see detailed information for automatically created events like this one, use the official Google Calendar app. https://g.co/calendar"

现在,如果这是由 google 创建的事件,并且他们已将 Google 日历 Web 应用程序设置为以不同方式解析信息,那么您实际上无能为力。这毕竟是免费服务。

如果我在你所在的地方,我会尝试在 Extended properties 中四处挖掘,它可能实际上就在那里。但是我不记得扩展属性是否是特定于应用程序的,方法是将其锁定为仅 Google 能够看到它。

Is it possible access this information from an automatically created event?

除非数据隐藏在某些地方的扩展属性中。

If not, why is Google restricting this information?

我的猜测是因为他们希望用户使用他们的应用程序以便他们可以销售广告。