lichessTVGamesmain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23type GameType =
30type Games = Record<GameType, Entry>;
31export async function lichessTVGames(): Promise<Games> {
32const channels = await fetch("https://lichess.org/api/tv/channels");
33return await channels.json();
34}
validatePostExistsmain.tsx3 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export const validatePostExists = async (slug) => {
4const response = await fetch("https://www.merlinmason.co.uk/posts.json");
5if (!response.ok) {
6throw new Error("Failed to fetch posts");
7}
8const posts = await response.json();
YoutubeTranscriptmain.tsx11 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export const YoutubeTranscript = async (url: string, metadata = true) => {
76}
77/**
78* An extensible class to fetch a transcript from a given YouTube Video
79*/
80class YoutubeTranscript {
81/**
82* Fetch a transcript from a YouTube Video which includes the text and timestamp metadata
83* @param videoId Video url or video identifier
84* @param config Options for specifying a Country and Language ISO
85*/
86static async fetchTranscript(
87videoId: string,
88config?: TranscriptConfig,
90const identifier = this.extractVideoId(videoId);
91try {
92const textResponse = await fetch(
93`https://www.youtube.com/watch?v=${identifier}`,
94);
100);
101}
102const transcriptResponse = await fetch(
103`https://www.youtube.com/youtubei/v1/get_transcript?key=${apiKey}`,
104{
123}
124/**
125* Fetch only the transcript text from a YouTube Video
126* @param videoId Video url or video identifier
127* @param config Options for specifying a Country and Language ISO
128*/
129static async fetchTranscriptText(
130videoId: string,
131config?: TranscriptConfig,
132): Promise<string> {
133const segments = await this.fetchTranscript(videoId, config);
134let out = "";
135for (const { text } of segments) {
283}
284if (metadata)
285return await YoutubeTranscript.fetchTranscript(url);
286return await YoutubeTranscript.fetchTranscriptText(url);
287};
hnTopStoriesmain.tsx5 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23// forked from @healeycodes.hnTopStories
5// hi florian
6export const hnTopStories = async () => {
7let valTownFetchLimit = 1;
8const topStories: Number[] = await fetch(
9"https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
10).then((res) => res.json());
11valTownFetchLimit--;
12const id = topStories[0];
13console.log({ id });
19score: number;
20by: string;
21} = await fetch(
22`https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`
23).then((res) => res.json());
1import { parentReference } from "https://esm.town/v/stevekrouse/parentReference?v=3";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3import { runVal } from "https://esm.town/v/std/runVal";
412// use user's rlimit.com namespace if defined
13if (namespaceId) {
14return await fetchJSON(
15`https://rlimit.com/${namespaceId}/${max}/${interval}/${key}?password=${namespacePassword}®ion=global`,
16);
1import { fetch } from "https://esm.town/v/std/fetch";
23export let replitGet = (REPLIT_DB_URL, key) => fetch(`${REPLIT_DB_URL}/${key}`);
pollVotingJobmain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23let { failureCount } = await import("https://esm.town/v/pranjaldotdev/failureCount");
20const token =
21"eyJhbGciOiJIUzI1NiJ9.eyJwbGF0Zm9ybSI6Imppb3Zvb3QiLCJ1c2VyaWR0eXBlIjoidXVpZCIsImlzSmlvVXNlciI6ZmFsc2UsImlzR3Vlc3QiOmZhbHNlLCJwaG9uZU5vIjoiMzM2NjBiNzQtM2U5YS00ZWJhLTlmMTMtNzBkNTQ3NmUwOTNkIiwicHJvZmlsZUlkIjoiMTE1ODc3YWQtZDE3Mi00YTAwLWI2OTMtMDlkZmNjNTEwOTMyIiwiaWF0IjoxNjg5NzA0MzA0LCJleHAiOjE2ODk3OTA3MDR9.ICKpSLJJexKR0wjDYDMpctvdTV33P0J6pxL3MAxWJyg";
22const response = await fetch(votingURL, {
23method: "POST",
24headers: {
getWeathermain.tsx4 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export async function getWeather(city: string) {
4try {
5const response = await fetch(`https://wttr.in/${city}?format=j1`);
6if (!response.ok) {
7throw new Error(`Failed to fetch data for ${city}`);
8}
9const jsonData = await response.json();
14}
15catch (error) {
16throw new Error(`Failed to fetch weather data: ${error}`);
17}
18}
1import { fetch } from "https://esm.town/v/std/fetch";
2import { big_stories_ranks } from "https://esm.town/v/tmcw/big_stories_ranks";
3import process from "node:process";
5export let big_story = (async () => {
6const nytimes =
7await (await fetch(
8`https://api.nytimes.com/svc/topstories/v2/home.json?api-key=${process.env.nytimes_api_key}`,
9)).json();
testVTClientmain.tsx1 match
5const apiClient = createApiClient("https://api.val.town");
6const params = {
7params: { username: "stevekrouse", val_name: "fetchJSON" },
8};
9const user = await apiClient.getValname(params);