Code
HTTP
import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
export const tvshows = async function() {
const TV_SHOWS_WATCHED = [
// Ted Lasso
97546,
// Reservation Dogs
95215,
// Survivor
14658,
// Great British Bake-off
87012,
// Kotaro Lives Alone
134581,
// Laid-back Camp
76075,
// Frieren
209867,
];
const data = [];
for (var i = 0; i < TV_SHOWS_WATCHED.length; ++i) {
const show_id = TV_SHOWS_WATCHED[i];
const url = `https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`;
const resp = await fetch(url);
const show = await resp.json();
data.push(show);
}
data.sort(function(a, b) {
if (a.last_air_date > b.last_air_date)
return -1;
if (a.last_air_date < b.last_air_date)
return 1;
return 0;
});
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
glench-tvshows.web.val.run
Updated: December 16, 2024