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}」的可用数据`)
	}	
}

Prerequisites

  1. Subscribe Listen API from here
  2. Duplicate the podcast table template below
  3. Read the Usage steps

先决条件

  1. 这里获取 Listen API
  2. 复制下面的模板到你的工作空间
  3. 查看使用说明中的步骤

播客

<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>

Usage

  1. Replace the value of variable API_KEY with your own Listen API Token
  2. Replace the value of TABLE_URL with your own podcast table
  3. Press ⌘ / Ctrl + P to call search panel, input add_podcast PODCAST_NAME, then use ⌥ / Alt + Enter to execute the action

使用说明

  1. 替换变量 API_KEY 的值为你自己的 Listen API Token
  2. 替换变量 TABLE_URL 为你的播客表格
  3. 使用 ⌘ / Ctrl + P 调出搜索框,输入 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>

Demo video - 演示视频

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