veltrixcode commited on
Commit
7172853
·
verified ·
1 Parent(s): b1e3e0a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -285
README.md CHANGED
@@ -1,285 +1,10 @@
1
- # YouTube Music & YouTube API (Unofficial)
2
-
3
- Flask wrapper around `ytmusicapi` and `youtube-search-python-fork` exposing simple unauthenticated endpoints for both YouTube Music and regular YouTube content.
4
-
5
- **Base URL**: `https://ytm-jgmk.onrender.com`
6
-
7
- **Interactive API Docs**: https://ytm-jgmk.onrender.com/docs/
8
-
9
- ## Quick Start
10
-
11
- ### Local Development
12
-
13
- 1. Create a virtualenv (optional)
14
- 2. Install dependencies:
15
- ```bash
16
- pip install -r requirements.txt
17
- ```
18
- 3. Run the server:
19
- ```bash
20
- python app.py
21
- ```
22
- - Server: http://localhost:8000
23
- - Docs: http://localhost:8000/docs/
24
-
25
- ### Production Deployment
26
- ```bash
27
- waitress-serve --host=0.0.0.0 --port=8000 app:app
28
- ```
29
-
30
- ## API Endpoints
31
-
32
- ### Health Check
33
- - **GET** `/health` - API health status
34
-
35
- ### YouTube Music API (via ytmusicapi)
36
-
37
- #### Search
38
- - **GET** `/api/search?q={query}&filter={filter}&limit={limit}`
39
- - Search YouTube Music content
40
- - **Filters**: `songs`, `videos`, `albums`, `artists`, `playlists`, `profiles`, `podcasts`, `episodes`, `community_playlists`
41
- - **Example**: `https://ytm-jgmk.onrender.com/api/search?q=oasis&filter=songs&limit=10`
42
-
43
- - **GET** `/api/search/suggestions?q={query}`
44
- - Get search suggestions
45
- - **Example**: `https://ytm-jgmk.onrender.com/api/search/suggestions?q=oasi`
46
-
47
- #### Content Details
48
- - **GET** `/api/songs/{video_id}`
49
- - Get song details by video ID
50
- - **Example**: `https://ytm-jgmk.onrender.com/api/songs/ZuB1I4eY2vE`
51
-
52
- - **GET** `/api/albums/{browse_id}`
53
- - Get album details and tracks
54
- - **Example**: `https://ytm-jgmk.onrender.com/api/albums/MPREb_DemoBrowseId`
55
-
56
- - **GET** `/api/artists/{browse_id}`
57
- - Get artist information and releases
58
- - **Example**: `https://ytm-jgmk.onrender.com/api/artists/UC123ArtistBrowseId`
59
-
60
- - **GET** `/api/playlists/{playlist_id}?limit={limit}`
61
- - Get playlist details and items
62
- - **Example**: `https://ytm-jgmk.onrender.com/api/playlists/PL123456789?limit=50`
63
-
64
- #### Explore & Discovery
65
- - **GET** `/api/charts?country={country}`
66
- - Get music charts (global or by country)
67
- - **Example**: `https://ytm-jgmk.onrender.com/api/charts?country=US`
68
-
69
- - **GET** `/api/moods`
70
- - Get mood/genre categories
71
- - **Example**: `https://ytm-jgmk.onrender.com/api/moods`
72
-
73
- - **GET** `/api/moods/{category_id}`
74
- - Get playlists for a mood/genre category
75
- - **Example**: `https://ytm-jgmk.onrender.com/api/moods/egVnKQ`
76
-
77
- - **GET** `/api/watch_playlist?videoId={id}&radio={bool}&shuffle={bool}&limit={limit}`
78
- - Get watch playlist (radio/shuffle)
79
- - **Example**: `https://ytm-jgmk.onrender.com/api/watch_playlist?videoId=ZuB1I4eY2vE&radio=true&limit=25`
80
-
81
- ### YouTube API (via youtube-search-python-fork)
82
-
83
- #### Search
84
- - **GET** `/api/yt_search?q={query}&filter={filter}&limit={limit}`
85
- - Search YouTube content
86
- - **Filters**: `all`, `videos`, `channels`, `playlists`
87
- - **Example**: `https://ytm-jgmk.onrender.com/api/yt_search?q=music&filter=videos&limit=10`
88
-
89
- #### Content Details
90
- - **GET** `/api/yt_channel/{channel_id}`
91
- - Get YouTube channel information
92
- - **Example**: `https://ytm-jgmk.onrender.com/api/yt_channel/UC_x5XG1OV2P6uZZ5FSM9Ttw`
93
-
94
- - **GET** `/api/yt_playlists?q={query}&limit={limit}`
95
- - Search YouTube playlists
96
- - **Example**: `https://ytm-jgmk.onrender.com/api/yt_playlists?q=music&limit=20`
97
-
98
- ## Usage Examples
99
-
100
- ### YouTube Music Search
101
- ```bash
102
- # Search for songs
103
- curl "https://ytm-jgmk.onrender.com/api/search?q=oasis&filter=songs&limit=5"
104
-
105
- # Get search suggestions
106
- curl "https://ytm-jgmk.onrender.com/api/search/suggestions?q=oasi"
107
-
108
- # Get charts
109
- curl "https://ytm-jgmk.onrender.com/api/charts?country=US"
110
- ```
111
-
112
- ### YouTube Search
113
- ```bash
114
- # Search videos
115
- curl "https://ytm-jgmk.onrender.com/api/yt_search?q=music&filter=videos&limit=5"
116
-
117
- # Search channels
118
- curl "https://ytm-jgmk.onrender.com/api/yt_search?q=tech&filter=channels&limit=3"
119
-
120
- # Search playlists
121
- curl "https://ytm-jgmk.onrender.com/api/yt_playlists?q=music&limit=10"
122
- ```
123
-
124
- ## Sample Responses (local run snapshots)
125
-
126
- Note: These are abbreviated examples to illustrate the response shape. Fields may vary based on content and availability.
127
-
128
- ### Health
129
- GET `/health`
130
- ```json
131
- { "status": "ok" }
132
- ```
133
-
134
- ### YouTube Music
135
-
136
- GET `/api/search?q=music&filter=songs&limit=1`
137
- ```json
138
- {
139
- "results": [
140
- {
141
- "resultType": "song",
142
- "title": "Rain Sound (Pure White Noise for Natural Deep Sleep Inducing)",
143
- "videoId": "13EL6Mgeocc",
144
- "duration": "3:20:01",
145
- "duration_seconds": 12001,
146
- "artists": [
147
- { "id": "UCo5JkRVziPY8hl5VCpukMkQ", "name": "White Noise Masters" },
148
- { "id": "UC0VD-Sorq2XpUagaoemRAMA", "name": "Deep Sleep" }
149
- ],
150
- "album": {
151
- "id": "MPREb_k9b0KESuAJF",
152
- "name": "Rain Sound 200 Minutes for Deep Sleep Inducing – White Noise..."
153
- },
154
- "thumbnails": [ { "url": "https://lh3.googleusercontent.com/...", "width": 60, "height": 60 } ]
155
- }
156
- ]
157
- }
158
- ```
159
-
160
- GET `/api/search/suggestions?q=music`
161
- ```json
162
- { "suggestions": ["music", "music to watch boys to", "sleeping music"] }
163
- ```
164
-
165
- GET `/api/songs/{video_id}` (example: `13EL6Mgeocc`)
166
- ```json
167
- {
168
- "videoDetails": {
169
- "videoId": "13EL6Mgeocc",
170
- "title": "Rain Sound (Pure White Noise for Natural Deep Sleep Inducing)",
171
- "author": "White Noise Masters - Topic",
172
- "lengthSeconds": "12001"
173
- },
174
- "microformat": { "microformatDataRenderer": { "appName": "YouTube Music" } }
175
- }
176
- ```
177
-
178
- GET `/api/albums/{browse_id}` (example: `MPREb_k9b0KESuAJF`)
179
- ```json
180
- {
181
- "title": "Rain Sound 200 Minutes for Deep Sleep Inducing – White Noise...",
182
- "artists": [{ "id": "UCo5JkRVziPY8hl5VCpukMkQ", "name": "White Noise Masters" }],
183
- "tracks": [ { "videoId": "13EL6Mgeocc", "title": "Rain Sound ...", "length": "3:20:01" } ]
184
- }
185
- ```
186
-
187
- GET `/api/artists/{browse_id}` (example: `UCyX0TcJ20FifnGP3M6J-IXQ`)
188
- ```json
189
- {
190
- "name": "Meditation Music",
191
- "songs": { "results": [ { "videoId": "...", "title": "..." } ] },
192
- "albums": { "results": [ { "browseId": "...", "title": "..." } ] }
193
- }
194
- ```
195
-
196
- GET `/api/playlists/{playlist_id}?limit=5`
197
- ```json
198
- {
199
- "id": "RDCLAK5uy_nDL8KeBrUagwyISwNmyEiSfYgz1gVCesg",
200
- "title": "Mellow Pop Classics",
201
- "author": "YouTube Music",
202
- "tracks": [ { "videoId": "...", "title": "...", "artists": [ { "name": "..." } ] } ]
203
- }
204
- ```
205
-
206
- GET `/api/charts?country=US`
207
- ```json
208
- {
209
- "error": "Charts data unavailable: Charts service temporarily unavailable",
210
- "message": "YouTube Music charts are currently not accessible. This may be due to regional restrictions or service limitations.",
211
- "fallback": "Try using the search endpoint instead: /api/search?q=trending&filter=songs"
212
- }
213
- ```
214
-
215
- GET `/api/moods`
216
- ```json
217
- {
218
- "Genres": [ { "title": "African", "params": "ggMPOg1uX0..." }, { "title": "Arabic" } ],
219
- "Moods & moments": [ { "title": "Chill", "params": "ggMPOg1uX1..." }, { "title": "Sleep" } ]
220
- }
221
- ```
222
-
223
- GET `/api/moods/{category_id}` (example: Chill category param)
224
- ```json
225
- [
226
- {
227
- "title": "Coffee Shop Blend",
228
- "description": "Playlist • YouTube Music",
229
- "playlistId": "RDCLAK5uy_nBE4bLuBHUXWZrF59ZrkPEToKt8M_I3Vc",
230
- "thumbnails": [ { "url": "https://lh3.googleusercontent.com/...", "width": 226, "height": 226 } ]
231
- }
232
- ]
233
- ```
234
-
235
- GET `/api/watch_playlist?videoId=13EL6Mgeocc&radio=true&limit=3`
236
- ```json
237
- {
238
- "tracks": [ { "videoId": "...", "title": "...", "length": "..." } ],
239
- "related": true
240
- }
241
- ```
242
-
243
- ### YouTube
244
-
245
- GET `/api/yt_search?q=music&filter=videos&limit=1`
246
- ```json
247
- {
248
- "query": "music",
249
- "filter": "videos",
250
- "results": [ { "title": "Shaky (Official Video) ...", "channel": { "name": "..." }, "duration": "3 minutes, 35 seconds" } ]
251
- }
252
- ```
253
-
254
- GET `/api/yt_channel/{channel_id}` (example: `UC_x5XG1OV2P6uZZ5FSM9Ttw`)
255
- ```json
256
- {
257
- "channel_id": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
258
- "channel_info": { "title": "Google for Developers", "subscribers": "...", "link": "https://round-darkness-b543.bob17040246.workers.dev/..." }
259
- }
260
- ```
261
-
262
- GET `/api/yt_playlists?q=music&limit=1`
263
- ```json
264
- {
265
- "query": "music",
266
- "playlists": [ { "title": "...", "playlistId": "PL...", "channel": { "name": "..." } } ]
267
- }
268
- ```
269
-
270
- ### Standard Error Response
271
- ```json
272
- { "error": "Human-readable error message" }
273
- ```
274
-
275
- ## Rate Limits & Notes
276
-
277
- - **Unauthenticated Access**: This API uses unauthenticated access, so some features may be limited compared to logged-in YouTube Music
278
- - **Rate Limits**: No explicit rate limits, but please use responsibly
279
- - **Data Source**: YouTube Music data via `ytmusicapi`, YouTube data via `youtube-search-python-fork`
280
-
281
- ## References
282
-
283
- - **ytmusicapi documentation**: https://ytmusicapi.readthedocs.io/en/stable/
284
- - **youtube-search-python-fork**: https://github.com/ahmedayyad-dev/youtube-search-python-fork
285
- - **Interactive API Docs**: https://ytm-jgmk.onrender.com/docs/
 
1
+ ---
2
+ title: Ytm
3
+ emoji: 💻
4
+ colorFrom: pink
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ short_description: aaa
10
+ ---