如何从 URL 中抓取嵌入式 Google 日历?

How can I scrape an embedded Google Calendar from a URL?

我正在创建一个 iOS 应用程序,我正在尝试从网页显示一个 Google 日历。日历是 public。现在我在 UIWebView 中显示整个页面,它充满了将用户带到外部链接的按钮。我只想显示日历。我怎样才能只从 url 中抓取日历并将其显示在网络视图中?

我试过:

https://www.google.com/calendar/feeds/username%40gmail.com/public/basic

但是 returns 一个白屏说 Forbidden Error 403

我找到了解决办法。这是我使用的代码。您可以调整数据以获得您想要的结果,但这对我有用。在 gcal 字符串中,只需将 USER@gmail.com 更改为您日历的 gmail 帐户。我不得不调整大小,让它也恰好填满屏幕。

    NSString *gcal = [NSString stringWithFormat:@"<html><meta name=\"viewport\" content=\"width=%f\"/><iframe src=\"http://www.google.com/calendar/embed?showTitle=0&amp;showNav=1&amp;showTabs=1&amp;showPrint=0&amp;showCalendars=0&amp;mode=AGENDA&amp;height=600&amp;wkst=1&amp;hl=en_GB&amp;src=USER@gmail.com&amp;color=%%23BE6D00&amp;ctz=America%%2FNew_York\" scrolling=\"no\" style=\"border-width: 0pt;\" mce_style=\" border-width:0 \" frameborder=\"0\" height=\"%f\" width=\"%f\"></iframe>",self.view.frame.size.width,self.view.frame.size.height-70,self.view.frame.size.width-8];
    [self.webView loadHTMLString:gcal baseURL:nil];