all repos — fixyoutube-go @ 0c53037d82b827f00b3bdce97e197c45af008673

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    url TEXT NOT NULL,
11    timestamp DATETIME DEFAULT (datetime('now')),
12    expire DATETIME NOT NULL
13);`
14
15const createQueryFormats = `
16CREATE TABLE IF NOT EXISTS formats (
17    videoId TEXT,
18	name TEXT,
19    height TEXT NOT NULL,
20    width TEXT NOT NULL,
21    url TEXT,
22	PRIMARY KEY (videoId, name),
23	FOREIGN KEY(videoId) REFERENCES videos(videoId)
24);`
25
26const getVideoQuery = "SELECT * FROM videos WHERE videoId = (?);"
27
28const cacheVideoQuery = "INSERT OR REPLACE INTO videos (videoId, title, description, uploader, duration, url, expire) VALUES (?, ?, ?, ?, ?, ?, ?);"
29
30const clearQuery = "DELETE FROM videos;"