async (name) => {
const API_KEY = 'YOUR_API_TOKEN'
const API_URL = `https://listen-api.listennotes.com/api/v2/search?q=${name}&type=podcast&offset=0&len_min=10&len_max=30&only_in=title`
const TABLE_URL = '<https://www.notion.so/ruter/a386e47f2436410ca4e0afb7ac1bf50c?v=5e3633e725c947ea95b29bd4d9e00c8c>'
let headers = new Headers();
headers.append('X-ListenAPI-Key', API_KEY)
let res = await fetch(API_URL, {
mode: 'cors',
headers: headers
})
const data = await res.json()
if (data.count) {
const podcast = data.results[0]
const table = await nb.fetch(TABLE_URL)
table.addRow({
Name: name,
Logo: [podcast.image],
Author: podcast.publisher_original,
Desc: podcast.description_original,
RSS: podcast.rss,
Website: podcast.website,
})
} else {
showMsg(`未找到播客「${name}」的可用数据`)
}
}
<aside> 💡 Please note that Listen API is third-party service, so we WON'T give any help of the API relevant issues, such as how to subscribe API. 由于 Listen API 是第三方提供的服务,我们将不会提供任何 API 相关的帮助,例如怎么注册获取 API。
</aside>
API_KEY
with your own Listen API TokenTABLE_URL
with your own podcast tableadd_podcast PODCAST_NAME
, then use ⌥ / Alt + Enter to execute the actionAPI_KEY
的值为你自己的 Listen API TokenTABLE_URL
为你的播客表格add_podcast PODCAST_NAME
后按下 ⌥ / Alt + Enter 执行动作<aside>
🚨 Please make sure your TABLE_URL
is copy from a Full Page table but not Inline Table.
请确保你的 TABLE_URL
不是 Inline Table 所在页面的 URL 而是 Full Page 页面的 URL。
</aside>
https://s3-us-west-2.amazonaws.com/secure.notion-static.com/56d88d07-edf3-41b3-8a39-e295a988cf17/add_podcast_demo.mp4
@Ruter Lü 添加使用说明 March 13, 2020