Lioncat2002 / YouDash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Youdash

An API for searching the youtube data api

Installation:

  1. Make sure go is installed
  2. Define a .env file accordin to the .example-env
    in the format:
DB_URI=your-postgres-link
GCP_APIKEY="your-gcp-api-key-1 your-gcp-api-key-2 your-gcp-api-key-3"
  • Note: If you want to use multiple API Keys, they must be seperated by spaces and the entire string must be surrounded by quotes(")
  1. The Database used is cockroachDB but Postgres should also be compatible
  2. Run the project with go run main.go

Features:

  • Paginated Video Data fetched from Youtube API every 1 min
  • Data fetched can be sorted based on preference
  • Multiple GCP API Keys can be passed which automatically get switched based on quotas

API Endpoints:

  • Get All Videos:
    GET http://localhost:8080/api/video/?size=4&page=0&sort=-pub_date
    where, size denotes the number of data per page, page to define the current page and sort to define the sorting order
    Possible sorting orders:
    title,desc, pub_date, thumb_url, url and video_id
    to sort based on descending order, add a - infront like -pub_date

  • Get Video by VideoID:

GET http://localhost:8080/api/video/:videoId
where videoId is the youtube video id fetched from the youtube data api

  • Create Multiple Videos:
    POST http://localhost:8080/api/video/
    Accepts an array of video data in the following format
{
	"title":     "Video Title",
	"desc":      "Video Description",
	"pub_date":  "Video Publish Date in DateTime Format",
	"thumb_url": "Video thumbnail url",
	"video_id":  "Youtube video id",
}

The video url is auto generated by it before the insertion

Video Demo:

2023-08-17.15-51-34.mp4

About

License:MIT License


Languages

Language:Go 100.0%