all repos — fixyoutube-go @ 99d543cc2102abec08cf0a8250dc231a2059b8da

A better way to embed YouTube videos everywhere (inspired by FixTweet).

invidious/queries.go (view raw)

 1package invidious
 2
 3const createQueryVideos = `
 4CREATE TABLE IF NOT EXISTS videos (
 5    videoId TEXT PRIMARY KEY,
 6    title TEXT NOT NULL,
 7    description TEXT NOT NULL,
 8    uploader TEXT NOT NULL,
 9    duration int NOT NULL,
10    timestamp DATETIME DEFAULT (datetime('now')),
11    expire DATETIME NOT NULL
12);`
13
14const createQueryFormats = `
15CREATE TABLE IF NOT EXISTS formats (
16    videoId TEXT,
17	name TEXT,
18    height TEXT NOT NULL,
19    width TEXT NOT NULL,
20    url TEXT,
21	PRIMARY KEY (videoId, name),
22	FOREIGN KEY(videoId) REFERENCES videos(videoId)
23);`
24
25const getVideoQuery = "SELECT * FROM videos WHERE videoId = (?);"
26const getFormatQuery = "SELECT * FROM formats WHERE videoId = (?)"
27
28const cacheVideoQuery = "INSERT OR REPLACE INTO videos (videoId, title, description, uploader, duration, expire) VALUES (?, ?, ?, ?, ?, ?);"
29const cacheFormatQuery = "INSERT OR REPLACE INTO formats (videoId, name, height, width, url) VALUES (?, ?, ?, ?, ?);"
30
31const clearQuery = "DELETE FROM videos;"