Skip to content

Adding the Titles of Videos to Embedded YouTube Videos

During and after the times that I have written each of my Greasemonkey scripts, I look for ways to improve on these scripts. I often have ideas in mind for adding features to them and for making them more efficient. And when I consider it a high enough priority to implement these improvements, these scripts get updated.

And recently, an event occurred that made it a priority for me to make one of these updates to one of my scripts. I actually considered adding the titles of the YouTube videos embedded into web pages to the links that are added below these videos when this script is used. In addition to being able to visit the page on YouTube on which the embedded video can be found, one may want to know the title of the embedded video before playing it. And after a user requested that I add this feature to this script, updating this script became my new highest priority.

This idea was one that I originally had when I found out about this script that adds titles of videos to the links to YouTube videos. I thought that it was a very good idea to make this script available, and it had been downloaded and installed many times. This script could be used with the script that I wrote to display the titles of embedded videos. However, I have found that this script does not always add the titles to the links that my script adds. Also, I would prefer to have the functionality for adding these titles in my script in order to save users the trouble of having to look for another script.

A drawback of adding this functionality to the script is that it is addition of a feature that some might not want. Some may not want the overhead of having these HTTP requests done to retrieve video titles, and some may simply find this feature unnecessary. And many may already have the script for adding titles of videos to these links that I previously mentioned, and so this script may sometimes add the video title a second time. For these reasons, I added a feature for toggling whether or not video titles are to be displayed. And below is a link to a screen shot that shows a web page on which the script is running, with the option to not display videos titles visible.

I wanted this updated version of the script to be made available as soon as possible. Therefore, I looked up the answers to questions I had in code that already existed. Some of the code in my script is quite obviously based on what already exists in the script for adding the titles of YouTube videos to the links to these videos. I also referred to this page on the GreaseSpot Wiki in adding the option for toggling whether or not to include video titles in these links. I often prefer to find solutions to problems on my own, although this time, trying to solve the problem without referring to code that already exists would likely be considered reinventing the wheel. However, it was also requested that I add these links to embedded videos blocked by the NoScript Firefox extension, as my script did not previously add links to videos blocked by NoScript. And I did not look up any answers in ensuring that it would add links to videos blocked by this extension.

I would like to know about any issues that this new version of the script has. It worked well in the tests that I ran with it, although the possibility that there might be instances in which it does not work properly does exist. I am also always interested in hearing suggestions on how this script can be improved. For example, the page must be refreshed for the changes to the setting for toggling whether or not to include the video title to take effect. Some might prefer that the page automatically be refreshed after this setting is changed, and some may have other suggestions for improvements to the script. It was a suggestion that led to this improvement, and so if you have any ideas on what can be done to improve on it further, I would like to know about these ideas. Scripts such as these are for users like you, and it is your suggestions that make me more likely continue improving on them.

5 Comments