getRandomDogImgmain.tsx3 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export const getRandomDogImg = async (
5res: express.Response,
6) => {
7const data = await fetch("https://dog.ceo/api/breeds/image/random", {
8method: "get",
9redirect: "follow",
19catch (e) {
20throw new Error(
21`fetchJSON error: ${e.message} in ${req.baseUrl}\n\n"${t}"`,
22);
23}
searchManifoldMarketsmain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23type Market = {
6};
7export async function searchManifoldMarkets(query: string) {
8const result = await fetch(
9`https://manifold.markets/api/v0/search-markets?${query}`,
10);
tidbytDeviceInfomain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23export function tidbytDeviceInfo({ deviceId, apiKey }: {
5apiKey: string;
6}) {
7return fetchJSON(
8`https://api.tidbyt.com/v0/devices/${deviceId}`,
9{
nameNationalitymain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23// Predict the nationality of a name
4export let nameNationality = fetchJSON(
5"https://api.nationalize.io/?name=michael"
6);
1import { fetch } from "https://esm.town/v/std/fetch";
23export let fetchJSON = async (url: string, options?: any) => {
4let f = await fetch(url, {
5...options,
6headers: {
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);