Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/lemonase/youtube-meme-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/lemonase/youtube-meme-api

  • v0.0.0-20210515192554-f84b61155e89
  • Source
  • Go
  • Socket score

Version published
Created
Source

YouTube Meme API

The intention of this API is to fetch random meme videos/playlist/channels from a Google Sheet and learn a little bit about Go while doing it.

The API uses the Go standard library to route HTTP paths to functions.

All "backend" data for this project is stored in this sheet for ease of editing and sharing. Recommendations can be added using this form

The "frontend" is a single index.html template with embedded iframes for the YT video and form (this is served by Go's builtin http server).

How it works

The data is fetched from the Google Sheets API with the Go client library. Additional video/playlist info is retrieved from the YouTube Data API with the associated Go library.

HTTP Endpoints

Hosted on Heroku: https://youtube-meme-api.herokuapp.com

GET

  • / - Home page
  • /api/ - See all available endpoints

API "Random" Endpoints

  • /api/v1/random/video - Gets a random video
  • /api/v1/random/playlist - Gets a random playlist
  • /api/v1/random/playlist/item - Gets a random playlist item (playlist video)
  • /api/v1/random/channel - Gets a random channel

API "List" Endpoints

  • /api/v1/all/video - Gets all videos
  • /api/v1/all/playlist - Gets all playlists
  • /api/v1/all/playlist/item - Gets all playlists items/videos
  • /api/v1/all/channel - Gets all channels

Client usage examples

Web browser

Go to https://youtube-meme-api.herokuapp.com The default video is a randomized playlist item from the sheet.

Bash

endpoint="https://youtube-meme-api.herokuapp.com/api/v1/random/playlist/item"
vid_id="$(curl -sSL $endpoint | jq .contentDetails.videoId | sed 's/"//g')"
vid_url="https://www.youtube.com/watch?v=$vid_id"

# on linux
xdg-open $vid_url

# on mac
open $vid_url

PowerShell

$endpoint = "https://youtube-meme-api.herokuapp.com/api/v1/random/playlist/item"
$vid_id = ((iwr "$endpoint").Content | ConvertFrom-Json).contentDetails.videoId
$vid_url = "https://www.youtube.com/watch?v=$vid_id"

start chrome $vid_url

FAQs

Package last updated on 15 May 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc