fix for updated yt render/metadata code

This commit is contained in:
Cooper Hammond 2020-11-08 00:47:23 -07:00
parent bf29194042
commit a8a1c4d1c3

View file

@ -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