YouTube Stats and Thumbnail Download avatar

YouTube Stats and Thumbnail Download

Try for free

Pay $10.00 for 1,000 results

Go to Store
YouTube Stats and Thumbnail Download

YouTube Stats and Thumbnail Download

xscapeco/youtube-stats-and-thumbnail-download
Try for free

Pay $10.00 for 1,000 results

Extract stats, thumbnails and profile pic from YouTube videos with ease! This actor takes a YouTube video URL as input and returns lots of data.

This Apify Actor extracts various statistics, thumbnails, and profile pictures from YouTube videos. It takes a list of YouTube video URLs as input and returns detailed information about each video.

Input

The Actor expects a JSON input with a startUrls array containing one or more YouTube video URLs. For example:

1{
2"startUrls": [
3"https://www.youtube.com/watch?v=aAkMkVFwAoo"
4]
5}

Output

For each valid YouTube video URL provided in the input, the Actor will push an object to the dataset with the following fields:

  • video_id: The unique ID of the YouTube video.
  • thumbnail_url: The URL of the video's thumbnail image.
  • view_count: The number of views for the video.
  • description: The video's description.
  • upload_date: The date and time the video was uploaded (in ISO format).
  • upload_date_epoch: The upload date as a Unix timestamp.
  • upload_date_formatted: The upload date formatted as "YYYY-MM-DD HH:MM:SS".
  • duration: The video duration in the format "HH:MM:SS".
  • duration_seconds: The video duration in seconds.
  • video_url: The original YouTube video URL from the input.
  • profile_name: The name of the channel that uploaded the video.
  • profile_image_url: The URL of the channel's profile picture.
  • channel_subscribers: The number of subscribers for the channel.
  • channel_handle: The channel's handle (e.g., "@channelname").
  • video_likes: The number of likes for the video.

Implementation Details

The Actor uses the Google API Client Library for Python to interact with the YouTube Data API. It extracts the video ID from the provided YouTube URL and then fetches various details about the video, including its statistics, thumbnail, and channel information.

The get_video_id function extracts the video ID from different types of YouTube URLs (e.g., https://www.youtube.com/watch?v=aAkMkVFwAoo, https://youtu.be/aAkMkVFwAoo).

The download_thumbnail function downloads the video's thumbnail image and returns its local file path and URL.

The convert_duration function converts the video duration from the ISO 8601 format to a more readable "HH:MM:SS" format.

The duration_to_seconds function converts a duration string in the "HH:MM:SS" format to seconds.

The get_video_info function fetches various details about the video, including its statistics, thumbnail, description, upload date, duration, and channel information.

The main function is the entry point for the Actor. It retrieves the input URLs, processes each valid URL, and pushes the video information to the dataset.

Resources

Developer
Maintained by Community

Actor Metrics

  • 6 monthly users

  • 1 star

  • >99% runs succeeded

  • Created in Oct 2024

  • Modified 2 months ago