|
|
@ -456,9 +456,10 @@ class Video
|
|
|
|
is_family_friendly: Bool,
|
|
|
|
is_family_friendly: Bool,
|
|
|
|
genre: String,
|
|
|
|
genre: String,
|
|
|
|
genre_url: String,
|
|
|
|
genre_url: String,
|
|
|
|
license: {
|
|
|
|
license: String,
|
|
|
|
|
|
|
|
sub_count_text: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
default: "",
|
|
|
|
default: "0",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -490,11 +491,14 @@ def get_video(id, db, proxies = {} of String => Array({ip: String, port: Int32})
|
|
|
|
video = fetch_video(id, proxies)
|
|
|
|
video = fetch_video(id, proxies)
|
|
|
|
video_array = video.to_a
|
|
|
|
video_array = video.to_a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Migration point
|
|
|
|
|
|
|
|
video_array = video_array[0..-2]
|
|
|
|
|
|
|
|
|
|
|
|
args = arg_array(video_array[1..-1], 2)
|
|
|
|
args = arg_array(video_array[1..-1], 2)
|
|
|
|
|
|
|
|
|
|
|
|
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,\
|
|
|
|
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,\
|
|
|
|
published,description,language,author,ucid, allowed_regions, is_family_friendly,\
|
|
|
|
published,description,language,author,ucid,allowed_regions,is_family_friendly,\
|
|
|
|
genre, genre_url, license)\
|
|
|
|
genre,genre_url,license)\
|
|
|
|
= (#{args}) WHERE id = $1", video_array)
|
|
|
|
= (#{args}) WHERE id = $1", video_array)
|
|
|
|
rescue ex
|
|
|
|
rescue ex
|
|
|
|
db.exec("DELETE FROM videos * WHERE id = $1", id)
|
|
|
|
db.exec("DELETE FROM videos * WHERE id = $1", id)
|
|
|
@ -505,6 +509,9 @@ def get_video(id, db, proxies = {} of String => Array({ip: String, port: Int32})
|
|
|
|
video = fetch_video(id, proxies)
|
|
|
|
video = fetch_video(id, proxies)
|
|
|
|
video_array = video.to_a
|
|
|
|
video_array = video.to_a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Migration point
|
|
|
|
|
|
|
|
video_array = video_array[0..-2]
|
|
|
|
|
|
|
|
|
|
|
|
args = arg_array(video_array)
|
|
|
|
args = arg_array(video_array)
|
|
|
|
|
|
|
|
|
|
|
|
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
|
|
|
|
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
|
|
|
@ -662,11 +669,18 @@ def fetch_video(id, proxies)
|
|
|
|
if license
|
|
|
|
if license
|
|
|
|
license = license.content
|
|
|
|
license = license.content
|
|
|
|
else
|
|
|
|
else
|
|
|
|
license ||= ""
|
|
|
|
license = ""
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub_count_text = html.xpath_node(%q(//span[contains(@class, "yt-subscriber-count")]))
|
|
|
|
|
|
|
|
if sub_count_text
|
|
|
|
|
|
|
|
sub_count_text = sub_count_text["title"]
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
sub_count_text = "0"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
video = Video.new(id, info, Time.now, title, views, likes, dislikes, wilson_score, published, description,
|
|
|
|
video = Video.new(id, info, Time.now, title, views, likes, dislikes, wilson_score, published, description,
|
|
|
|
nil, author, ucid, allowed_regions, is_family_friendly, genre, genre_url, license)
|
|
|
|
nil, author, ucid, allowed_regions, is_family_friendly, genre, genre_url, license, sub_count_text)
|
|
|
|
|
|
|
|
|
|
|
|
return video
|
|
|
|
return video
|
|
|
|
end
|
|
|
|
end
|
|
|
|