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.

Submit this entry to any of these sites: del.icio.us Digg Furl Reddit blogmarks Google Spurl StumbleUpon Technorati Yahoo!

5 Comments

  1. blahblah wrote:

    Some replying to what you say in your message above:

    About the situation if one is on a site, which does already provide a link with title under a embedded Youtube video, then it is nice that this is a Userscript and not a Userstyle (the following is one of the Userscripts/Greasemonkeys advantages): then you can just in the Greasemonkey ‘Manage User Scripts…’ Manager, list that page/pages under ‘Excluded Pages’.

    Then about suggestion on improving features…
    You mentioned yourself that “the page must be refreshed for the changes (…) to take effect.”
    My comment: It would be nice if the refresh wasn’t necessary, but not sure it is possible do have it like that.

    You go on saying “Some might prefer that the page automatically be refreshed after this setting is changed”
    My comment: Hmm you could try to include an option (one you could toggle on/off) for this. But I would be very skeptic about this, if it meant that turning on the script, resulted in all of your tabs was refreshed. That would be very annoying if having for example 20+ tabs open.

    Cheers

    Sunday, May 11, 2008 at 4:02 pm | Permalink
  2. blahblah wrote:

    Some replying to what you say in your message above:

    About the situation if one is on a site, which does already provide a link with title under a embedded Youtube video, then it is nice that this is a Userscript and not a Userstyle (the following is one of the Userscripts/Greasemonkeys advantages): then you can just in the Greasemonkey ‘Manage User Scripts…’ Manager, list that page/pages under ‘Excluded Pages’.

    Then about suggestion on improving features…
    You mentioned yourself that “the page must be refreshed for the changes (…) to take effect.”
    My comment: It would be nice if the refresh wasn’t necessary, but not sure it is possible do have it like that.

    You go on saying “Some might prefer that the page automatically be refreshed after this setting is changed”
    My comment: Hmm you could try to include an option (one you could toggle on/off) for this. But I would be very skeptic about this, if it meant that turning on the script, resulted in all of your tabs was refreshed. That would be very annoying if having for example 20+ tabs open.

    Cheers.

    Sunday, May 11, 2008 at 4:03 pm | Permalink
  3. blahblah wrote:

    Sorry for double post :/
    But it tricked me that I had to allow this site in NoScript in order to post or else it just said something like “sorry, didn’t find what you was looking for” together with showing an empty search box. On: http://jake.kasprzak.ca/2007/09/30/link-to-youtube-video-pages-from-embedded-youtube-videos/#comment-5754 it went just fine without allowing the site in NoScript…

    Sunday, May 11, 2008 at 4:07 pm | Permalink
  4. blahblah wrote:

    P.S. Thanks for putting the screenshot on there along with your comment.

    It lead me to discover:
    1. That it is possible to go to the ‘User Scripts Commands…’ by right-clicking the Monkey icon. I had not noticed that. I only thought that it was possible via the ‘Tools’ Menu and so on as described here: http://userscripts.org/scripts/show/13333 .
    That was a time saver, nice!
    2. The ‘Screen Userscripts’ script: http://userscripts.org/scripts/show/11388 . I have often been nervous wondering if maybe a script I install is not clean (you have experienced me being this).
    3. The ‘Web Form Data Analyzer’ script: http://userscripts.org/scripts/show/24512 .
    Took me a test on the search form on userscripts.org to understand what it does. Pressing enter while in the form box returned this: http://img161.imageshack.us/img161/2939/webformgo6.png
    Don’t really know if I can use it for anything serious, but I plan to try it on my online banks web form just for curiosity/fun.
    4. number 3. lead me to discover this video: http://youtube.com/watch?v=8hghpuxCHTc which is indeed very nice :D

    Cheers

    Sunday, May 11, 2008 at 5:01 pm | Permalink
  5. jkasprzak wrote:

    Hello, and thank you again for your feedback.

    I have given more thought to the question of whether or not to have the page refresh automatically after toggling whether titles are to be displayed or not. And I might need to take more time to think of what the ideal solution to this problem might be. Whether or not such a solution will be implemented soon may depend on how much demand there is for this solution to be implemented.

    As for what you discovered via the screen shot that I posted, I was actually hoping that some of those who clicked on it noticed what you noticed. I wanted to draw attention to the scripts that I had listed there. And it is also good to know about what else you discovered after seeing that screen shot.

    Thanks again,

    J.K.

    Monday, May 12, 2008 at 3:50 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*