Readme

scrape_gradio_data

Scrapes the gradio_config object from Gradio sites/spaces. Most useful when pointed at a gradio site with lots of static data like the Open LLM Leaderboard

1
2
3
4
5
6
7
8
9
10
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
export const scrape_gradio_data = async (url) => {
const cheerio = await import("npm:cheerio@1.0.0-rc.12");
const html = await fetchText(url);
const $ = cheerio.load(html);
// This is the part most likely to break:
const blob = $("script:nth-of-type(2)").first().text().slice(23, -1);
return JSON.parse(blob);
};
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!
October 23, 2023