1/** @jsxImportSource https://esm.sh/hono@3.9.2/jsx **/
2
3import { Homepage } from "https://esm.town/v/nbbaier/dbToAPIFrontend";
4import { checkResource, getResources, type Options, validate } from "https://esm.town/v/nbbaier/dbToApiHelpers";
5import { Hono } from "npm:hono";
6
20 };
21
22 return fetchJSON(`https://api.val.town/v1/vals/${valId}`, {
23 headers: {
24 Authorization: `Bearer ${token}`,
14 };
15
16 return fetchJSON("https://api.val.town/v1/vals", {
17 headers: {
18 Authorization: `Bearer ${token}`,
1# Fetch Paginated Data
2
3This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:
7```ts
8const id = <vt user id>
9await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
10 headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` },
11});
1## Create an API from a [lowdb blob](https://www.val.town/v/pomdtr/lowdb)
2
3This val exports a function that takes a lowdb instance and returns a [Hono](https://hono.dev) router that can be used to interact with the data. This is the beginning of an implementation of something like [json-server](https://github.com/typicode/json-server) for Val Town.
4
5The resulting server also comes with a frontend at `/`. The code for the frontend can be found [here](https://www.val.town/v/nbbaier/dbToAPIFrontend).
6
7See [this val](https://www.val.town/v/nbbaier/dbToAPIexample) for an example.
8
9### Things I'd like to implement
5export let hasValTownStyleGuideUpdated = async (since: Date) => {
6 let commits = await fetchJSON(
7 "https://api.github.com/repos/val-town/val.town/commits?path=/src/style.tsx&since=" +
8 since.toISOString(),
9 {
1# Get YT Video Information
2
3Given a youtube video url, this val returns a small amount of information about the video: title, channel title, and the description. It uses the Youtube Data API v3, so you need to bring your own API key to get it to work (see [here](https://developers.google.com/youtube/v3/getting-started) about setting up an API key).
14and the `excludes` for what you don't want to get notified for.
15
16You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
17
18## 2. Notification
22## Twitter Data & Limitations
23
24The Twitter API has become unusable. This val gets Twitter data via [SocialData](https://socialdata.tools),
25an affordable Twitter scraping API. In order to make this val easy for
26you to fork & use without signing up for another API, I am proxying
27SocialData via @stevekrouse/socialDataProxy. Val Town Pro users can call this proxy a limited amount per day.
28
29If you want to run it more, get your own [SocialData](https://socialdata.tools)
30API token and pay for it directly.
31
32Legacy folder path: Archive/polls/twitter/twitterAlert