Pradeep Saini
Pradeep Saini

Reputation: 336

Facebook graph API call for external URL not working with Youtube Urls

I was trying to get details of youtube urls using for example this video url :

/v2.5/?id=https://www.youtube.com/watch?v=AU_a76wE8fg

but whatever video url I use, its returning this template result -

 {
 "og_object": {
    "id": "10150122667264389",
    "description": "Judas Priest's official music video for 'Turbo Lover'. Click to listen to Judas Priest on Spotify: http://smarturl.it/JudasPriestSpotify?IQid=JudasPTL As fea...",
    "title": "Judas Priest - Turbo Lover",
    "type": "video.other",
    "updated_time": "2016-01-17T18:59:08+0000",
    "url": "https://www.youtube.com/watch?v=JhY9GOhFwN4"
  },
  "share": {
    "comment_count": 28,
    "share_count": 40022
  },
  "id": "https://www.youtube.com/watch?v"
}

What is wrong. Is facebook API broken for external urls from youtube ? Because its working fine with other website urls.

Upvotes: 0

Views: 96

Answers (1)

Tobi
Tobi

Reputation: 31479

You need to UrlEncode the URL, because it contains a =. This is visible because the result contains only "id": "https://www.youtube.com/watch?v" and not "id": "https://www.youtube.com/watch?v=AU_a76wE8fg"

So /v2.5/?id=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAU_a76wE8fg should to the trick.

Upvotes: 1

Related Questions