Currently playing (Chrome) auto detect across websites

I wrote this script a while back which allows me to be able to see at any point the title of the video I am watching. It works for most websites that support html5 video and also checks whether the video is playing or paused.

First time using Applescript and the entire job is a bit hacky! Would love feedback on how I can streamline the process.

You will need to give permission to Chrome to execute Applescripts. I also wrote some custom logic to integrate Netflix, Amazon Prime videos, and Twitch better. Since it relies on html so heavily, the script may need to be updated from time to time.

Here's a link to the Applescript: