Socket
Book a DemoInstallSign in
Socket

github.com/pcpratham/youtube-api-fetcher

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/pcpratham/youtube-api-fetcher

v0.0.0-20241228183122-2f9bc0e614ee
Source
Go
Version published
Created
Source

YouTube API Fetcher

A Go-based project that fetches the latest YouTube videos for a predefined search query using the YouTube Data API, stores them in a MySQL database, and provides an API for paginated responses. This project supports multiple API keys for rate limit handling and includes a background fetch mechanism for keeping data up-to-date.

Features

  • Fetch YouTube videos based on a predefined search query.
  • Store video data (title, description, etc.) in a MySQL database.
  • Provide paginated responses for easy client-side consumption.
  • Background job to fetch and update video data periodically.

Prerequisites

  • Go 1.20+
  • MySQL 8+
  • YouTube Data API Key(s) (from the Google Cloud Console)

Installation

  • Clone the Repository:
    git clone https://github.com/pcpratham/youtube-api-fetcher.git
    cd youtube-api-fetcher
    
  • Creation of .env file:
   YOUTUBE_API_KEY=your_youtube_api_key
   DATABASE_URL=your_database_url
   PORT=your_port_number
  • Run to install all dependencies:
   go mod tidy
  • Set up database:
   CREATE DATABASE youtube_fetcher;
  • Run command:
    go run ./cmd/server/main.go
  • To check API hit this CURL
       curl --location 'http://localhost:8080/videos?page=5&limit=10' \
       --header 'Content-Type: application/json'
    

FAQs

Package last updated on 28 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.