Public
Script
October 23, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { lookupTwitterIdFree } from "https://esm.town/v/stevekrouse/lookupTwitterIdFree";
import process from "node:process";
import { turso } from "https://esm.town/v/stevekrouse/turso";
export const populateTwitterDB = async () => {
let client = await turso({
url: process.env.tursoURL,
authToken: process.env.tursoToken,
});
let data = await client.execute(
"select twitter_id from twitter_users where twitter_handle is null limit 1",
);
console.log(data);
let id = data.rows[0].twitter_id;
let handle = await lookupTwitterIdFree(id);
console.log(handle);
return client.execute({
sql:
"update twitter_users set twitter_handle = :handle where twitter_id = :id",
args: { id, handle },
});
};
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