Script Summary: Filter YouTube search results based on time (+/- 1 second)
Revisions
v1.1 Update:
2009.25.06
- Feature Added: Added display of current filter setting between the set and clear links
- Feature Added: Now hides Channels and Shows in addition to Playlists and Promoted Videos
- Bug Fixed: Removed an extra unnecessary redraw of video cells
- Bug Fixed: Fixed cases where seconds are 59 or 0, which was causing filter malfuncion
Description
Purpose: I developed this script to help me win a game my friends and I play, wherein a screenshot of a YouTube video is distributed to players by a moderator. Players race to find the source video. The only pieces of information visible in the screenshot are the video display area and the progress bar, which includes the current and total run-time of the video.
Obstacle: As of this writing (June 24, 2009), YouTube supports only very rough filtering of search results based on duration--the options are: < 4 min., 4-20 min., > 20 min. For our game, these are unacceptably wide ranges. I do not want to have to look at each search page so carefully. Another factor that was brought to my attention fairly quickly, when playing this game, is that the video duration displayed in the lower-right corner of each thumbnail may in fact be one second different than what will show up on the progress bar when watching the video (or taking a screenshot).
Solution: For the above reasons, I created a script that adds a link, "Set Time Filter," under the search bar on results pages, allowing the user to set a time filter. This will hide video descriptions and thumbnails from the results if their durations are not within one second of the desired time. This filter also sets a cookie containing the desired time so that the user can perform many searches and move through results pages while the filter persists. The "Clear" link removes the filter instantly.
This script also hides the "Promoted Videos" and "Playlists". If you do not like this particular behavior, feel free to comment out those few lines of code. They are well marked.



