summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-06-01 17:24:16 -0500
committerOmar Roth <omarroth@hotmail.com>2018-06-01 17:24:16 -0500
commita2e23f702217f8187ce738ee544f759cf89091a1 (patch)
treeef2532df679ca56aba1479554700693f43332d1e
parentcbe10784aada0606167686fafdfdad2a89ae4bed (diff)
downloadinvidious-a2e23f702217f8187ce738ee544f759cf89091a1.tar.gz
invidious-a2e23f702217f8187ce738ee544f759cf89091a1.tar.bz2
invidious-a2e23f702217f8187ce738ee544f759cf89091a1.zip
Move author and ucid into schema
-rw-r--r--config/sql/videos.sql2
-rw-r--r--src/helpers.cr7
2 files changed, 7 insertions, 2 deletions
diff --git a/config/sql/videos.sql b/config/sql/videos.sql
index 2fb52946..63a42e66 100644
--- a/config/sql/videos.sql
+++ b/config/sql/videos.sql
@@ -15,6 +15,8 @@ CREATE TABLE public.videos
published timestamp with time zone,
description text COLLATE pg_catalog."default",
language text COLLATE pg_catalog."default",
+ author text COLLATE pg_catalog."default",
+ ucid text COLLATE pg_catalog."default",
CONSTRAINT videos_pkey PRIMARY KEY (id)
)
WITH (
diff --git a/src/helpers.cr b/src/helpers.cr
index a88e9304..9375b3a6 100644
--- a/src/helpers.cr
+++ b/src/helpers.cr
@@ -76,6 +76,8 @@ class Video
published: Time,
description: String,
language: String?,
+ author: String,
+ ucid: String,
})
end
@@ -194,8 +196,9 @@ def fetch_video(id, client)
end
title = info["title"]
-
views = info["view_count"].to_i64
+ author = info["author"]
+ ucid = info["ucid"]
likes = html.xpath_node(%q(//button[@title="I like this"]/span))
likes = likes.try &.content.delete(",").try &.to_i
@@ -238,7 +241,7 @@ def fetch_video(id, client)
end
end
- video = Video.new(id, info, Time.now, title, views, likes, dislikes, wilson_score, published, description, nil)
+ video = Video.new(id, info, Time.now, title, views, likes, dislikes, wilson_score, published, description, nil, author, ucid)
return video
end