모든 소스
TVMaze Schedule
엔터테인먼트 v1.0.0Today's TV episode schedule by country
@codytseng #tv #schedule #entertainment
설정
| 이름 | 키 | 유형 | 필수 | 기본값 | 설명 |
|---|---|---|---|---|---|
| Country | COUNTRY | select | 아니오 | US | Country for TV schedule USGBCAAU |
소스 코드
version: 1.0.0
name: TVMaze Schedule
description: Today's TV episode schedule by country
author: codytseng
author_url: https://github.com/codytseng
category: Entertainment
tags:
- tv
- schedule
- entertainment
config:
- key: COUNTRY
name: Country
type: select
required: false
default: US
description: Country for TV schedule
options:
- US
- GB
- CA
- AU version: 1.0.0
name: TVMaze Schedule
description: Today's TV episode schedule by country
author: codytseng
author_url: https://github.com/codytseng
category: Entertainment
tags:
- tv
- schedule
- entertainment
config:
- key: COUNTRY
name: Country
type: select
required: false
default: US
description: Country for TV schedule
options:
- US
- GB
- CA
- AU module.exports = async (api) => {
const country = api.config.get("COUNTRY") || "US";
async function fetchData() {
const res = await api.fetch(
`https://api.tvmaze.com/schedule?country=${country}`,
);
if (!res.ok || !res.json) {
throw new Error(`Failed to fetch TV schedule (HTTP ${res.status})`);
}
const items = res.json.map((episode) => ({
id: String(episode.id),
title: episode.show.name,
subtitle: episode.name,
url: episode.show.url,
timestamp: episode.airstamp,
}));
api.emit(items);
}
await fetchData();
return {
refresh: fetchData,
};
}; module.exports = async (api) => {
const country = api.config.get("COUNTRY") || "US";
async function fetchData() {
const res = await api.fetch(
`https://api.tvmaze.com/schedule?country=${country}`,
);
if (!res.ok || !res.json) {
throw new Error(`Failed to fetch TV schedule (HTTP ${res.status})`);
}
const items = res.json.map((episode) => ({
id: String(episode.id),
title: episode.show.name,
subtitle: episode.name,
url: episode.show.url,
timestamp: episode.airstamp,
}));
api.emit(items);
}
await fetchData();
return {
refresh: fetchData,
};
};