summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorÉmilien Devos <contact@emiliendevos.be>2021-06-25 17:37:37 +0200
committerGitHub <noreply@github.com>2021-06-25 15:37:37 +0000
commitce68d09d2653df27afea6d26d03838ce78b053cb (patch)
tree77bbe89d4c4c9c5c926c8d2b2060ede2bbbb6d05 /src
parent5a8825d01682def020acfd2baf95a44b94790f6f (diff)
downloadinvidious-ce68d09d2653df27afea6d26d03838ce78b053cb.tar.gz
invidious-ce68d09d2653df27afea6d26d03838ce78b053cb.tar.bz2
invidious-ce68d09d2653df27afea6d26d03838ce78b053cb.zip
Pick a random video for bypass captcha
pick a random video from the 1000 first rows of the channel_videos table in order to bypass the captcha more efficiently
Diffstat (limited to 'src')
-rw-r--r--src/invidious/jobs/bypass_captcha_job.cr6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/invidious/jobs/bypass_captcha_job.cr b/src/invidious/jobs/bypass_captcha_job.cr
index 87cf7688..71f8a938 100644
--- a/src/invidious/jobs/bypass_captcha_job.cr
+++ b/src/invidious/jobs/bypass_captcha_job.cr
@@ -2,7 +2,11 @@ class Invidious::Jobs::BypassCaptchaJob < Invidious::Jobs::BaseJob
def begin
loop do
begin
- {"/watch?v=zj82_v2R6ts&gl=US&hl=en&has_verified=1&bpctr=9999999999", produce_channel_videos_url(ucid: "UCK87Lox575O_HCHBWaBSyGA")}.each do |path|
+ random_video = PG_DB.query_one?("select id, ucid from (select id, ucid from channel_videos limit 1000) as s ORDER BY RANDOM() LIMIT 1", as: {id: String, ucid: String})
+ if !random_video
+ random_video = {id: "zj82_v2R6ts", ucid: "UCK87Lox575O_HCHBWaBSyGA"}
+ end
+ {"/watch?v=#{random_video["id"]}&gl=US&hl=en&has_verified=1&bpctr=9999999999", produce_channel_videos_url(ucid: random_video["ucid"])}.each do |path|
response = YT_POOL.client &.get(path)
if response.body.includes?("To continue with your YouTube experience, please fill out the form below.")
html = XML.parse_html(response.body)