back to top
HomeHow ToHow To Search YouTube Videos By Length

How To Search YouTube Videos By Length [Solved]

Finding YouTube videos of a specific length can be frustrating. Whether you’re looking for a quick tutorial, a short clip, or a full-length video, knowing how to search by length can save you time and effort.

In this tutorial, I will share three simple methods to search YouTube videos by specific length. In the first method, we will use YouTube’s official API to search for and find videos of a specific duration.

The best part is you don’t have to write a single line of code. All you have to do is configure it the first time, and then use it whenever you want to find videos of a specific length.

The second method utilizes YouTube’s default search parameters to help you find videos of a specific length or duration on any browser. In the final method, we will go over the steps to accomplish the same task on an Android or iOS device.

Method 1: Using the YouTube API to Find Videos of Specific Length

This Python script offers several useful features for searching YouTube videos by length. It utilizes the YouTube Data API, allowing you to search for videos of any specific length, such as 5 minutes and 43 seconds or 1 hour and 23 seconds.

It runs in Google Colab, which means you don’t need to install anything. You just run the script in your browser, input your search term, and set the exact duration you’re looking for. The script takes care of the rest, finding videos that match your criteria.

You can also customize it to retrieve more results or adjust the way the data is displayed. It’s simple, flexible, and perfect for finding videos that fit your exact needs.

Let’s now see the exact steps to achieve our goal of finding YouTube videos of a specific duration.

Step 1: Create a New Google Cloud Project

Go to the Google Cloud Console. Click on “Select a project” and then “New Project“.

Enter a name for your project (e.g., “YouTube Video Search”) and click “Create“.

Step 2: Enable YouTube API

Once your project is created, go to the API & Services dashboard. Click on “Enable APIs and Services“.

Search for “YouTube Data API v3” and click on it.

enable youtube data api in google cloud console

 

Now, click “Enable” to enable the API for your project.

youtube data api v3

 

Step 3: Add Your API Key to the Code

Navigate to “Credentials” in the API & Services section.

create credentials api key

 

Click “Create Credentials” and select “API key“.

create api key youtube data api

 

Copy your API key and keep it secure.

Note: Do not share your API key publicly or expose it in shared code repositories, as it can be used by others and may result in usage limits or additional costs.

Step 4: Running the Python script in Google Colab to find YouTube videos of a specific duration

Open this Google Colab Notebook and sign in to your Google account. Now, add the API key generated in the previous step to the Python script here:

# Use the provided API key
API_KEY = ""

# Get user input
query = input("Enter the search term: ").strip()
hours = int(input("Enter hours (0 if none): ").strip())
minutes = int(input("Enter minutes (0 if none): ").strip())
seconds = int(input("Enter seconds (0 if none): ").strip())

Here’s the screenshot for your reference:

use api key to search youtube videos of specific length

 

After adding the API key, execute the Python script by clicking on the tiny Run Cell button.

Now, the script will prompt you to enter a search term and the duration of the video in hours, minutes, and seconds.

After you have specified these parameters, the Python script will use the YouTube API to find videos as per your search term and duration.

If it finds a video or videos of specific duration, it will display the YouTube video title, duration, and URL in the output cell, as shown below.

youtube video length finder python script

 

Now, simply click on the video to enjoy it.

Method 2: How to Find YouTube Videos By Length On Any Browser

In this method, we will simply use the default search filters provided by the YouTube website to filter video results based on their length.

Follow these steps to filter YouTube videos by length on any browser:

1. Open YouTube in your browser.

open youtube in your browser

 

2. Search for any video on YouTube.

search for any video on youtube

 

3. Now, click on the “Filters” option at the top-right of the results page.

click on filters option

 

4. Now, you will see the Filters dialog box.

youtube search filters to find videos by length

 

5. Select any duration to filter YouTube videos on the search results page.

find youtube videos by length

 

6. After you select a Duration filter, YouTube will show videos of that specific length only in the search results, as shown below.

videos of specific length in search results

7. To edit or remove the Duration search filter, click the “Filters” option again. After that, choose any other duration or remove the existing one by clicking the “X” button.

remove or change duration filter on youtube

 

Congrats! You have now successfully filtered YouTube videos by length.

Method 3: How to Search YouTube Videos by Length on Android or iOS App

If you are looking for a way to find YouTube videos based on their duration on any smartphone, then follow these steps:

1. Open the YouTube app on your phone.

open youtube app

 

2. Tap on the “search” button to find videos.

tap on search icon

 

3. Now, tap the “three-dots” button at the top-right.

tap on three dots menu on search results page

 

4. Choose the “Search filters” option.

choose the search filters option

 

5. Next, tap “Any” next to the “Duration” option.

choose duration to find youtube videos by length

 

6. Now, you can choose the duration for which you want to search the YouTube videos.

There are four options:

  • Any: Get videos of any duration on the search results page.
  • Under 4 minutes: Get videos shorter than 4 minutes on the search results page.
  • 4-20 minutes: Get videos between 4 to 20 minutes in length on the search results page.
  • Over 20 minutes: Get videos that are over 20 minutes in length on the search results page.

7. After selecting the duration, tap the “Apply” button, and the YouTube app will show only videos of that specific duration.

youtube videos filtered by specific duration

 

As I choose the “4-20 minutes” option, YouTube only shows videos of this specific duration. You can follow the same steps to find YouTube videos of any particular length.

Wrapping Up

Finding YouTube videos by specific length doesn’t have to be difficult. Whether you’re using YouTube’s built-in filters, searching through your browser, or running a Python script in Google Colab, you now have the tools to get precise results.

The first method, using a Python script, gives you more control and flexibility to find videos of any exact length you need.

The second and third methods let you use YouTube’s default search filters to find videos within preset time ranges.

Regardless of which method you choose, you can save time and find content that fits your needs without requiring any additional apps or complicated setups.

Frequently Asked Questions (FAQs)

1. How do you search YouTube videos by length?

To search YouTube videos by length, go to the search bar, type “video length” followed by your desired duration (e.g., “10 minutes”), and press enter.

2. How do I search for a video by duration?

To search for a video by duration, enter specific time constraints (e.g., “10 minutes”) in the search bar filters on the video platform of your choice.

3. How do I filter Google video searches by length?

To filter Google video searches by length, click “Tools” below the search bar, then select “Duration” and choose the desired duration option (e.g., “Short” or “Long”).

4. Is there a way to search within a YouTube video?

No, YouTube does not provide a native feature for searching within a video. Users can only search for videos using the search bar.

Himanshu Tyagi
Himanshu Tyagi
At CodeItBro, I help professionals, marketers, and aspiring technologists bridge the gap between curiosity and confidence in coding and automation. With a dedication to clarity and impact, my work focuses on turning beginner hesitation into actionable results. From clear tutorials on Python and AI tools to practical insights for working with modern stacks, I publish genuine learning experiences that empower you to deploy real solutions—without getting lost in jargon. Join me as we build a smarter tech-muscle together.

2 COMMENTS

Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Marc Sergian
Marc Sergian
11 days ago

Just a note, if you get an error about isodate not being a valid module, you might need to install it: !pip install isodate worked for me. If you never coded before, you need to place this line before “from isodate import…”

Cheers and thanks for the article!

RELATED ARTICLES