Skip to content

harshithvh/youtubeCrawler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

youtubeCrawler

To make an API to fetch latest videos sorted in reverse chronological order of their publishing date-time from YouTube for a given tag/search query in a paginated response.

Basic Requirements

  • Server should call the YouTube API continuously in background (async) with some interval (say 10 seconds) for fetching the latest videos for a predefined search query and should store the data of vid eos (specifically these fields - Video title, description, publishing datetime, thumbnails URLs and any other fields you require) in a database with proper indexes.
  • A GET API which returns the stored video data in a paginated response sorted in descending order of published datetime.
  • A basic search API to search the stored videos using their title and description.
  • It should be scalable and optimised.

Tech Stack

Docker Go MongoDB Postman JavaScript React Vite MaterialUI

Reference

Running the Backend

  • Clone the repo:

    git clone https://github.com/harshithvh/youtubeCrawler.git
    
  • Open directory in terminal:

    cd youtubeCrawler/backend
    
  • Create a .env file:

    API_KEYS=KEY1,KEY2
    MONGO_URI=mongodb://{HOST}:{PORT}/
    DATABASE_NAME=DATABASE_NAME
    COLLECTION_NAME1=COLLECTION_NAME1
    COLLECTION_NAME2=COLLECTION_NAME2
    
  • Install project dependencies:

    go get -u ./...
    
  • Fire up the server:

     go run main.go
    
  • Access api at:

    http://localhost:8080/
    

Running the Frontend

  • Open directory in terminal:

    cd youtubeCrawler/frontend
    
  • Install project dependencies:

    npm install 
    
  • Launch the frontend

    npm run dev
    
  • Access the dashboard at:

    http://localhost:3000/
    

Running with Docker

  • Build Docker images:

    docker build -t {image} .
    
  • Launch and run containers:

    docker run -p {port:port} {image}
    

APIs

param required type default
page false int 1
pageSize false int 10
sort false int -1
category true str
param required type default
page false int 1
pageSize false int 10
sort false int -1
query true str
category true str
param required type default
category true str

Screenshots

Ping Server

img

Home Page

img

Search Page

img

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published