From a8a1c4d1c37fb7feafcaefa93b9141f1767a0fb3 Mon Sep 17 00:00:00 2001 From: Cooper Hammond Date: Sun, 8 Nov 2020 00:47:23 -0700 Subject: [PATCH] fix for updated yt render/metadata code --- src/search/youtube.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/search/youtube.cr b/src/search/youtube.cr index de5a8b1..a42e4c7 100755 --- a/src/search/youtube.cr +++ b/src/search/youtube.cr @@ -197,8 +197,10 @@ module Youtube yt_initial_data : JSON::Any = JSON.parse("{}") response_body.each_line do |line| - if line.includes?("window[\"ytInitialData\"]") - yt_initial_data = JSON.parse(line.split(" = ")[1][0..-2]) + # timestamp 11/8/2020: + # youtube's html page has a line previous to this literally with 'scraper_data_begin' as a comment + if line.includes?("var ytInitialData") + yt_initial_data = JSON.parse(line.split(" = ")[1].delete(';')) end end