Git Product home page Git Product logo

reactmvc / youtube-node Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 3.0 21 KB

This is a fast and modern API for downloading videos, audios, thumbnails, and getting video information from YouTube. It's built with Node.js and uses the ytdl-core library to interact with YouTube.

Home Page: https://youtube.reactmvc.repl.co/api?url=https://youtu.be/r7calZbJJew

License: MIT License

JavaScript 100.00%
express-api node-youtube-data nodejs youtube-api youtube-downloader

youtube-node's Introduction

YouTube API

This is a fast and modern API for downloading videos, audios, thumbnails, and getting video information from YouTube. It's built with Node.js and uses the ytdl-core library to interact with YouTube.

Installation

To install and run this project, follow these steps:

  1. Clone the repository:
git clone https://github.com/ReactMVC/YouTube-Node.git
  1. Navigate into the project directory:
cd YouTube-Node
  1. Install the dependencies:
npm install
  1. Start the server:
npm start

The server will start running on port 3000.

Usage

This API provides two endpoints, both of which accept a YouTube URL and return information about the video.

GET Request

To send a GET request, use the /api endpoint and include the YouTube URL as a query parameter:

fetch('http://localhost:3000/api?url=YOUR_YOUTUBE_URL')
  .then(response => response.json())
  .then(data => console.log(data));

POST Request with Fetch

fetch('http://localhost:3000/api', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ url: 'YOUR_YOUTUBE_URL' }),
})
  .then(response => response.json())
  .then(data => console.log(data));

POST Request with Axios

const axios = require('axios');

axios.post('http://localhost:3000/api', {
  url: 'YOUR_YOUTUBE_URL'
})
.then(function (response) {
  console.log(response.data);
})
.catch(function (error) {
  console.error(error);
});

cURL Command for POST Request

You can also use cURL to send a POST request:

curl -X POST -H "Content-Type: application/json" -d '{"url":"YOUR_YOUTUBE_URL"}' http://localhost:3000/api

Response

The API will return a JSON object containing information about the video, including the title, description, view count, channel details, publish date, update date, embed details, thumbnails, and available formats.

Demo

You can try out the API at the following demo URL:

https://youtube.reactmvc.repl.co/api?url=YOUR_YOUTUBE_URL

Please replace youtube.reactmvc.repl.co with the actual URL where your API is hosted, and replace YOUR_YOUTUBE_URL with the URL of the YouTube video you want to get information about.

For example, if your API is hosted at api.example.com and you want to get information about the video at https://www.youtube.com/watch?v=dQw4w9WgXcQ, you would use the following URL:

http://api.example.com/api?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ

Developer Contact

For any queries or suggestions, you can reach out to the developer:

License

This project is licensed under the MIT License.

youtube-node's People

Contributors

reactmvc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.