0

I want to get list of videos of a particular YouTube channel.

I followed this SO answer https://stackoverflow.com/a/20795628/5383573 Every time I am getting

400 Bad Request

Suppose I want to get all the video of NDTV Channel.

Its YouTube url is https://www.youtube.com/user/ndtv/videos

I went to this URL https://developers.google.com/youtube/v3/docs/playlists/list

Fill the boxes as

Part: NDTV
Channel ID:ndtv
Max Result: 50

and click Execute

It gives me Request as

GET https://www.googleapis.com/youtube/v3/playlists?part=ndtv&channelId=ndtv&maxResults=50&key={YOUR_API_KEY}

And response

400 Bad Request

{
 "error": {
  "errors": [
   {
    "domain": "youtube.part",
    "reason": "unknownPart",
    "message": "ndtv",
    "locationType": "parameter",
    "location": "part"
   }
  ],
  "code": 400,
  "message": "ndtv"
 }
}

How can I get all the videos in JSON response? Sorry for my bad English.

Any help will be appreciated.Thanks in advance

Community
  • 1
  • 1
Developer
  • 1
  • 2

2 Answers2

0

Playlists: list has five valid parts

The list below contains the part names that you can include in the parameter value and the quota cost for each part:
contentDetails: 2
id: 0
player: 0
snippet: 2
status: 2

A your error message states ndtv is not valid part. NDTV is also not a valid channel id. A channel id looks like this UCtb0gXU-ht24V_fgeXGGjwA

The easest way tof ind the channel id is to check YouTube

https://www.youtube.com/channel/UCtb0gXU-ht24V_fgeXGGjwA

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
0

NDTV has 3 featured channels, those with channel_id

UCZFMm1mMw0F81Z37aaEzTUA,UC9CYT9gSNLevX5ey2_6CK0Q,UCf9StUUEcbRpbvpdKx5eS_g

The following GET requests will return json response.

GET https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId={ndtv_channel_id}

replace ndtv_channel_id with the channel id.

frank
  • 656
  • 3
  • 12