11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a [Deno script](https://github.com/pomdtr/val-town-mirror/blob/main/scripts/pull.ts) that fetches all vals from the Val Town API.
142. I pushed the data to a [Github Repository](https://github.com/pomdtr/val-town-mirror)
153. I added a [Github Action](https://github.com/pomdtr/val-town-mirror/blob/main/.github/workflows/sync.yaml) that runs the script every hour to refresh the data.
164. I created a simple frontend on top of the Github Search API that allows you to search the data. It's [hosted on Val Town](https://www.val.town/v/pomdtr/val_town_search) (obviously).
17
18That was it. I didn't have to build a complex search engine, I just used the tools that were available to me.
19
20Is this a scalable solution for Val Town? Probably not.\
21Am I abusing the Github API? Maybe.\
22Does it work better than the current search feature of Val Town? Absolutely!
23
11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a [Deno script](https://github.com/pomdtr/val-town-mirror/blob/main/scripts/pull.ts) that fetches all vals from the Val Town API.
142. I pushed the data to a [Github Repository](https://github.com/pomdtr/val-town-mirror)
153. I added a [Github Action](https://github.com/pomdtr/val-town-mirror/blob/main/.github/workflows/sync.yaml) that runs the script every hour to refresh the data.
164. I created a simple frontend on top of the Github Search API that allows you to search the data. It's [hosted on Val Town](https://www.val.town/v/pomdtr/val_town_search) (obviously).
17
18That was it. I didn't have to build a complex search engine, I just used the tools that were available to me.
19
20Is this a scalable solution for Val Town? Probably not.\
21Am I abusing the Github API? Maybe.\
22Does it work better than the current search feature of Val Town? Absolutely!
23
1import { api } from "https://esm.town/v/pomdtr/api";
2import { gfm } from "https://esm.town/v/pomdtr/gfm";
3import { callerRef } from "https://esm.town/v/pomdtr/refs";
11 title = `@${val.author}/${val.name}`;
12 }
13 const { readme = "" } = await api(`/v1/alias/${val.author}/${val.name}`);
14 return readme;
15}
11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a Deno script that fetches all vals from the Val Town API.
14
15```ts
24 .filter((line) => line.length > 0);
25
26let url = `https://api.val.town/v1/search/vals?limit=100&query=+`;
27const vals = [];
28while (true) {
73 .filter((line) => line.length > 0);
74
75let url = `https://api.val.town/v1/search/vals?limit=100&query=+`;
76const vals = [];
77while (true) {
108```
109
1104. I created a simple frontend on top of the Github Search API that allows you to search the data. It's [hosted on Val Town](https://www.val.town/v/pomdtr/val_town_search) (obviously).
111
112That was it. I didn't have to build a complex search engine, I just used the tools that were available to me.
113
114Is this a scalable solution for Val Town? Probably not.\
115Am I abusing the Github API? Maybe.\
116Does it work better than the current search feature of Val Town? Absolutely!
117
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
4
5PoV: You just hacked together a portfolio website or launched a blog as a static website. *Some people who visit might be interested in hearing more from you.* ❤️
6But you don't want to get lost building your backend, API, DB or fancy apps like SubstandardStack or MailMachineGun for people to sign up to your newsletter. 😩
7
8**All you want is a simple input box on your website - when someone types their `email`, `username` or `social link` in and submits it, you want to be notified.**
49
50 const response = await pushover({
51 token: Deno.env.get("PO_API_TOKEN")!,
52 user: Deno.env.get("PO_USER_KEY")!,
53 title,
58 console.log("Notified: ", response);
59 } catch (err) {
60 console.error("Error scraping newsletter ", err);
61 }
62};
18- *scraper* Goes to bytes.dev and scrapes latest published newsletter
19- *inserter* Insert it to SQLite if this newsletter already not exists
20- *notifier* Uses Pushover API to send ios mobile notifications
21
22### Pushover notifications
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12