Search
cleanHtml
@chet
An interactive, runnable TypeScript val by chet
Script
export function cleanHtml(html: string) {
// Remove script, link tags
html = html.replace(
/<\s*(script|link|time|form)\b[^<]*(?:(?!<\/\s*\1\s*>)<[^<]*)*<\/\s*\1\s*>/gi,
// Remove inputs because date initial values can change
html = html.replace(/<\s*(input)\b[^<]*\s*>/gi, "");
// Remove style attributes
html = html.replace(/ style="[^"]*"/gi, "");
// Separate all tags by newlines
html = html.replace(/><+/g, ">\n<");

manchesterBerylStations
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
export let manchesterBerylStations = fetchJSON(
"https://gbfs.beryl.cc/v2_2/Greater_Manchester/station_information.json",
).then((data) =>
data.data.stations.map((station) => {
const { station_id, name, lat, lon, capacity } = station;
const stationStatus =
manchesterBerylStationStatus[station.station_id];
const { num_bikes_available, num_docks_available } = stationStatus;
return ({
station_id,
primewire
@temptemp
An interactive, runnable TypeScript val by temptemp
Script
const NotFoundError = Error;
primewireApiKey,
primewireBase,
} from "https://raw.githubusercontent.com/Ciarands/mw-providers/dev/src/providers/sources/primewire/common.ts";
async function search(imdbId: string) {
const searchResult = await fetch(`${primewireBase}/api/v1/show?key=${primewireApiKey}&imdb_id=${imdbId}`);
return await searchResult.json().then((searchResult) => {
return searchResult.id;
async function getStreams(title: string) {
const titlePage = load(title);

weather
@cjpais
// Forked from @marcel.weather
Script
export const weather = async (city: string) => {
weather2(city)
.then(({ weather }) => ({
w: weather,
.then(({ w }) =>
w.map((d) => ({
maxTempF: `${d.maxtempF}`,
minTempF: `${d.mintempF}`,
description: d.hourly.map((h) => h.weatherDesc[0].value),
// Forked from @marcel.weather
val_YvPY6DIAQD
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export const jsonOkExample = () => Response.json({ ok: true });
primewire
@tempdev
An interactive, runnable TypeScript val by tempdev
Script
const NotFoundError = Error;
primewireApiKey,
primewireBase,
} from "https://raw.githubusercontent.com/Ciarands/mw-providers/dev/src/providers/sources/primewire/common.ts";
async function search(imdbId: string) {
const searchResult = await fetch(`${primewireBase}/api/v1/show?key=${primewireApiKey}&imdb_id=${imdbId}`);
return await searchResult.json().then((searchResult) => {
return searchResult.id;
async function getStreams(title: string) {
const titlePage = load(title);

remember
@mxderouet
An interactive, runnable TypeScript val by mxderouet
Script
export let remember = function () {
console.email("Remember to try val.town for Weather Bot");

annoy
@ajax
An interactive, runnable TypeScript val by ajax
Script
export async function annoy() {
const resume = resume2;
// const boo = await import("https://esm.sh/@atproto/api");
const { default: BskyAgent } = await import("npm:@atproto/api");
console.log(BskyAgent);
const agent = new BskyAgent.BskyAgent({ service: "https://bsky.social" });
await agent.login({
identifier: process.env.BLUESKY_USERNAME!,
password: process.env.BLUESKY_PASSWORD!,
// const actor = await agent.getProfile();

name_a_random_baby_name
@ajax
An interactive, runnable TypeScript val by ajax
HTTP
export default async function(req: Request): Promise<Response> {
return Response.json({ dumb_idea: "Maybe John", name: "Julie", baby_name: "Julie" });
valle_tmp_53901278199117542092711693057927
@janpaul123
// This val fetches weather data from an open API
HTTP
// This val fetches weather data from an open API
// The approach involves using the fetch API provided by Deno
// to retrieve weather information for a specific location
export default async function main(req: Request): Promise<Response> {
const apiUrl = "https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m¤t_weather=true";
const response = await fetch(apiUrl);
const weatherData = await response.json();
return new Response(JSON.stringify(weatherData), { headers: { "Content-Type": "application/json" } });

proxyFetch
@dpetrouk
// Forked from @alp.proxyFetch
Script
export const proxyFetch = async (req, res) => {
const { url, options } = req.body;
try {
const response = await fetch(url, options);
return res.status(response.status).send(await response.text());
catch (e) {
const errorMessage = e instanceof Error ? e.message : "Unknown error";
console.error("Failed to initiate fetch", e);
return res.status(500).send(`Failed to initiate fetch: ${errorMessage}`);
// Forked from @alp.proxyFetch
dataTableScript
@skyehersh
// Changes to the inputs will trigger a redraw to update the table
Script
const minEl = document.getElementById("min");
const maxEl = document.getElementById("max");
const searchEl = document.getElementById("search");
const desiredGenderEl = document.getElementById("desired-gender");
const yourGenderEl = document.getElementById("your-gender");
const styleEl = document.getElementById("style");
DataTable.ext.search.push(function(settings, data, dataIndex) {
let min = parseInt(minEl.value, 10);
let max = parseInt(maxEl.value, 10);
let age = parseFloat(data[1]) || 0;
generateQR
@loading
Generate QR codes Generate a QR code for any link instantly! Example https://neverstew-generateQR.web.val.run?url=https://neverstew.com
HTTP
# Generate QR codes
Generate a QR code for any link instantly!
## Example
[https://neverstew-generateQR.web.val.run?url=https://neverstew.com](https://neverstew-generateQR.web.val.run?url=https://neverstew.com)
export default async function server(req: Request): Promise<Response> {
let url: URL;
const base64Image = await qrcode(
`https://loading-file.web.val.run/?peer=${new URL(req.url).searchParams.get("peer")}`,
type: "text/html",
return Response.json({ base64Image });
replitSet
@claytn
An interactive, runnable TypeScript val by claytn
Script
import { fetch } from "https://esm.town/v/std/fetch";
export let replitSet = (REPLIT_DB_URL, key, value) =>
fetch(`${REPLIT_DB_URL}/${key}=${encodeURIComponent(value)}`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
valle_tmp_59342510692095097966010158625245
@janpaul123
// This val responds with an HTML form to input the user's name and greets them
HTTP
// This val responds with an HTML form to input the user's name and greets them
export default async function(req: Request): Promise<Response> {
const htmlResponse = `
<form action="/" method="POST">
<label for="name">Enter your name:</label><br>
<input type="text" id="name" name="name"><br>
<input type="submit" value="Submit">
</form>
return new Response(htmlResponse, {
headers: { "Content-Type": "text/html" },