Retrieving Image from Chrome (YouTube Music) using AppleScript JavaScript

I've written a script that retrieves cover art from YouTube Music tab in chrome. It works as expected, but after some time it stops working and I need to go into Better Touch Tool to 'refresh' it to get it to work again. Wondering if anyone can give some advice? Thanks!

tell application "Google Chrome"
	set foundVideo to false
	repeat with t in tabs of windows
		tell t
			if URL of t contains "music.youtube.com" then
				set artworkURL to execute javascript "artwork= document.querySelectorAll('img.image.style-scope.ytmusic-player-bar')[0].src;"
				do shell script "curl " & artworkURL & " -o ~/youtube_cover.png"
				set uri to "~/youtube_cover.png"
		
				return "{\"icon_path\":\"" & uri & "\"}"
				
			end if
		end tell
	end repeat
end tell