Welcome to the YouTube API π, a powerful PHP-based API for fetching YouTube video details and search results, built with π by Abir Arafat Chawdhury π§π©, the coding maestro from @ISmartDevs and @TheSmartDev! π Whether youβre searching for videos by song name πΆ or diving into specifics with a video URL π, this API delivers rich data with a sprinkle of tech magic! βοΈβ¨
This API is a sleek tool that uses the YouTube Data API v3 to interact with YouTubeβs vast video library, created by Abir Arafat Chawdhury, the genius behind SmartToolsBot and CEO of SmartDev. With expertise in Python, JavaScript, PHP, and full-stack web development, Abir has crafted an API thatβs both powerful and easy to use! ππ«
- Hosted at: abirthetech.serv00.net/yt.php π‘
- GitHub Repo: github.com/TheSmartDev/YouTube-API π
- Features:
- Fetch video details (title, channel, description, thumbnail, duration, views, likes, comments) from a YouTube URL. π¬
- Search for videos by query (e.g., song name) and get up to 10 results with rich metadata. π
- Clean JSON responses with a developer signature. β
Example: abirthetech.serv00.net/yt.php?query=tum+hi+ho
{
"status": true,
"creator": "API DEVELOPER @TheSmartDev & @ISmartDevs",
"result": [
{
"title": "\"Tum Hi Ho\" Aashiqui 2 Full Song With Lyrics | Aditya Roy Kapur, Shraddha Kapoor",
"channel": "T-Series",
"imageUrl": "https://i.ytimg.com/vi/Umqb9KENgmk/hqdefault.jpg",
"link": "https://youtube.com/watch?v=Umqb9KENgmk",
"duration": "4m 28s",
"views": "438075911",
"likes": "2948207",
"comments": "116629"
},
{
"title": "\"Tum Hi Ho Aashiqui 2\" Full Video Song HD | Aditya Roy Kapur, Shraddha Kapoor | Music - Mithoon",
"channel": "T-Series",
"imageUrl": "https://i.ytimg.com/vi/IJq0yyWug1k/hqdefault.jpg",
"link": "https://youtube.com/watch?v=IJq0yyWug1k",
"duration": "5m 10s",
"views": "321737239",
"likes": "2849522",
"comments": "87893"
}
// ... more results
]
}
Example: abirthetech.serv00.net/yt.php?query=https://youtube.com/watch?v=asxmdFaIock
{
"status": true,
"creator": "API DEVELOPER @TheSmartDev & @ISmartDevs",
"result": {
"title": "Meri Aashiqui Ab Tum Hi Ho Full Song (Lyrics) - Arijit Singh | Lyrics Tube",
"channel": "Lyrics Tube π",
"description": "Meri Aashiqui Ab Tum Hi Ho Full Song (Lyrics) - Arijit Singh | Lyrics Tube\n\nPlease Make Sure To Like, Share And Subscribe.βΊβΊβΊ\n\nFull Song Lyrics:\n\nHum tere bin ab reh nahi sakte...",
"imageUrl": "https://i.ytimg.com/vi/asxmdFaIock/hqdefault.jpg",
"link": "https://youtube.com/watch?v=asxmdFaIock",
"duration": "5m 46s",
"views": "13597456",
"likes": "215129",
"comments": "4568"
}
}
- Video Details: Extract title, channel, description, thumbnail, duration, views, likes, and comments from a YouTube URL. πΉ
- Search Videos: Find up to 10 videos by query (e.g., song name, artist) with detailed metadata. π
- Human-Readable Duration: Converts ISO 8601 durations (e.g., PT5M46S) into formats like
5m 46s
. β±οΈ - Error Handling: Graceful responses for invalid queries or API errors. β
- Lightweight: Single PHP file for easy deployment. β‘
-
Try it Live:
- Search by song: abirthetech.serv00.net/yt.php?query=tum+hi+ho πΆ
- Video details: abirthetech.serv00.net/yt.php?query=https://youtube.com/watch?v=asxmdFaIock π₯
-
Host Your Own:
- Download
yt.php
from the GitHub repo. π₯ - Upload it to your server via cPanel or any web hosting service. π€
- Replace
YOUTUBE_API_KEY
inyt.php
with your YouTube Data API key. π - Access your endpoint:
yourdomain.com/yt.php?query={query}
π - Done! Your YouTube API is live! π
- Download
-
Get a YouTube Data API Key:
To use this API, you need a YouTube Data API v3 key from Google Cloud. Follow these detailed steps to sign up and enable the API:- Step 1: Sign Up for Google Cloud
- Visit Google Cloud Console. π
- Sign in with your Google account or create a new one.
- If prompted, agree to the terms of service and set up a billing account (required for API access, though free tier may suffice for limited usage).
- Step 2: Create a Project
- Click the project dropdown at the top and select New Project.
- Give your project a name (e.g.,
YouTube-API-Project
) and click Create.
- Step 3: Enable YouTube Data API v3
- Go to the API & Services > Library section in the Google Cloud Console.
- Search for YouTube Data API v3 and click on it.
- Click Enable to activate the API for your project. βοΈ
- Step 4: Generate an API Key
- Navigate to API & Services > Credentials.
- Click Create Credentials > API Key.
- Copy the generated API key. π
- (Optional) Restrict the key to the YouTube Data API v3 for security under the API restrictions tab.
- Step 5: Add API Key to
yt.php
- Open
yt.php
and replace the placeholder with your key:define("YOUTUBE_API_KEY", "your_actual_youtube_api_key_here");
- Open
- Step 1: Sign Up for Google Cloud
- Clone the repo:
git clone https://github.com/TheSmartDev/YouTube-API.git
- Upload
yt.php
to your serverβs root or a subdirectory. π - Edit
yt.php
and insert your YouTube Data API key:define("YOUTUBE_API_KEY", "your_actual_youtube_api_key_here");
- Ensure your server supports PHP and file_get_contents. β
- Test your endpoint:
yourdomain.com/yt.php?query=tum+hi+ho
π
- Creator Cred: Built by Abir Arafat Chawdhury, a coding legend from @ISmartDevs and @TheSmartDev. π§ββοΈ
- Powered by YouTube Data API v3: Leverages Googleβs official API for reliable data. π‘
- Versatile: Handles both video URLs and search queries with ease. π―
- Simple Deployment: One PHP file, no fuss! β‘
- Rich Data: Pulls detailed video info for your apps or projects. π
- Reliable: Robust error handling and clean JSON output. β
Love to make this API even better? Fork the repo, add your spark, and submit a pull request! Letβs create something epic together. π
Visit the GitHub repo for details. π
Abir Arafat Chawdhury is the mastermind behind this API. As the CEO of SmartDev, creator of SmartToolsBot, and a full-stack guru, Abir shines in Python, JavaScript, PHP, and more. Follow his work at @ISmartDevs and @TheSmartDev for tech brilliance! π
This project is licensed under the MIT License. See the LICENSE file for details. π
Try it now: abirthetech.serv00.net/yt.php?query=tum+hi+ho πΆ
Host your own: Grab yt.php
from GitHub and unleash the power of YouTube data! β¨
Questions? Reach out to @ISmartDevs or open an issue on GitHub. π
YouTube API: Created by Abir Arafat Chawdhuryr! π»π