如何使用Google表格获取最新的Apple播客日期?

时间:2018-01-15 12:48:39

标签: google-sheets

我有一个包含Apple Podcasts网址的电子表格。

enter image description here

我想要做的是获得最新的播客日期。

enter image description here

所以基本上是第一个网格单元元素的“sort-value”标签的内容:

<td role="gridcell" sort-value="2017/12/22" class="release-date">

可以使用 IMPORTHTML 功能吗?

示例播客网址:https://itunes.apple.com/us/podcast/modern-sewciety-podcast/id742393907

2 个答案:

答案 0 :(得分:2)

这个怎么样?

=INDEX(IMPORTXML(A1, "//td[@class='release-date']//span[@class='text']"), 1)
  • https://itunes.apple.com/us/podcast/modern-sewciety-podcast/id742393907位于单元格&#34; A1&#34;。
  • XPath是//td[@class='release-date']//span[@class='text']
  • 使用INDEX检索最高价值。

enter image description here

编辑:

关于单元格的值变为43091的原因,认为是由于单元格格式。为了修改这种情况,请尝试以下两种模式。

  1. 使用43091修改单元格的格式。
    • 在电子表格中,请选择&#34;格式化&#34; - &GT; &#34;数&#34; - &GT; &#34;日期&#34;
    • 如果您想要其他日期格式,请自定义。
  2. 使用此XPath。
    • =INDEX(IMPORTXML(A1, "//td[@class='release-date']/@sort-value"), 1)
    • 在此XPath中,日期格式与//td[@class='release-date']//span[@class='text']不同。

答案 1 :(得分:0)

我无法提供有关Google表格的详细信息,但是我可以告诉您,您可以通过使用Apple Media Lookup API更快地获取此数据。

使用ID号742393907对此API端点进行调用:https://itunes.apple.com/lookup?id=742393907

这将返回以下JSON:

{
    "resultCount": 1,
    "results": [
        {
            "wrapperType": "track",
            "kind": "podcast",
            "collectionId": 742393907,
            "trackId": 742393907,
            "artistName": "Stephanie Kendron: Modern Creative blogger and podcaster",
            "collectionName": "Modern Sewciety Podcast",
            "trackName": "Modern Sewciety Podcast",
            "collectionCensoredName": "Modern Sewciety Podcast",
            "trackCensoredName": "Modern Sewciety Podcast",
            "collectionViewUrl": "https://podcasts.apple.com/us/podcast/modern-sewciety-podcast/id742393907?uo=4",
            "feedUrl": "http://www.modernsewciety.com/feed/podcast",
            "trackViewUrl": "https://podcasts.apple.com/us/podcast/modern-sewciety-podcast/id742393907?uo=4",
            "artworkUrl30": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/30x30bb.jpg",
            "artworkUrl60": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/60x60bb.jpg",
            "artworkUrl100": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/100x100bb.jpg",
            "collectionPrice": 0.00,
            "trackPrice": 0.00,
            "trackRentalPrice": 0,
            "collectionHdPrice": 0,
            "trackHdPrice": 0,
            "trackHdRentalPrice": 0,
            "releaseDate": "2020-03-08T16:39:00Z",
            "collectionExplicitness": "cleaned",
            "trackExplicitness": "cleaned",
            "trackCount": 50,
            "country": "USA",
            "currency": "USD",
            "primaryGenreName": "Design",
            "contentAdvisoryRating": "Clean",
            "artworkUrl600": "https://is5-ssl.mzstatic.com/image/thumb/Podcasts113/v4/db/f3/1d/dbf31d7f-3fae-84a6-c4b6-91adebc2394d/mza_4725542195606703711.jpg/600x600bb.jpg",
            "genreIds": [
                "1402",
                "26",
                "1301"
            ],
            "genres": [
                "Design",
                "Podcasts",
                "Arts"
            ]
        }
    ]
}

您想要releaseDate字段,该字段是从播客的最新剧集中提取的。