This project is a Node.js application that uses the Express.js framework to create a simple YouTube information fetcher.
- API: This project doesn't use YouTube's API; it instead "scrapes" the public web pages for the information.
| Name | Path | Body Content | Protocol | Response |
|---|---|---|---|---|
| Search | /search |
query |
POST |
ReducedVideo |
| Get Playlist Details | /get_playlist |
url |
POST |
Playlist |
| Get Video Details | /get_video |
url |
POST |
FullVideo |
| Get Channel Details | /get_channel |
url (/@[...] or /channel/[...]) |
POST |
DepthChannel |
| Get A Channel's Videos | /get_channel_videos |
url (/@[...] or /channel/[...]) |
POST |
ReducedVideo |
Fetching information on a YouTube video:
curl -X POST http(s)://[your_domain]:[your_port]/get_video
-H "Content-Type: application/json"
-d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}' Fetching information on a YouTube channel:
curl -X POST http(s)://[your_domain]:[your_port]/get_channel
-H "Content-Type: application/json"
-d '{"url": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"}' Fetching a list of a channel's videos:
curl -X POST http(s)://[your_domain]:[your_port]/get_channel_videos
-H "Content-Type: application/json"
-d '{"url": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"}' Fetching playlist information:
curl -X POST http(s)://[your_domain]:[your_port]/get_playlist
-H "Content-Type: application/json"
-d '{"url": "https://www.youtube.com/playlist?list=PLlaN88a7y2_qSLH3pLiQIQ6isY_DZTtdg"}' Searching YouTube:
curl -X POST http(s)://[your_domain]:[your_port]/search
-H "Content-Type: application/json"
-d '{"query": "What is the rickroll trend?"}' The application includes error-handling middleware.
The server listens on port 3000. To start the server, use the following command:
node main.jsYou should see the message "Server is running on port 3000" in the console.
- Add more endpoints to fetch other types of data from YouTube.
- Improve error handling to provide more detailed error messages.
- Add tests to ensure the reliability of the application.
Pull requests are welcome. For major changes, please open an issue first to discuss what you want to change.