0

I'm trying to insert a YouTube player on the page. I use the API telegra.ph/api. Tell me, please, where is my error?

https://api.telegra.ph/createPage?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb&title=Sample+Page&author_name=Anonymous&content=[{"tag":"p","children":["Hello,+world!"]},{"tag":"figure","children":[{"tag":"iframe","attrs":[{"src":"https://www.youtube.com/embed/J5iXWsmZQeM"}]},{"tag":"figcaption","children":["https://i.ytimg.com/vi/1cO-ZcQJCP4/hqdefault.jpg"]}]}]&return_content=true

Nick Datsky
  • 13
  • 1
  • 3

1 Answers1

0

Here is an example:

https://api.telegra.ph/createPage?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb&title=Sample+Page&author_name=Anonymous&content=[{"tag":"figure","children":[{"tag":"iframe","attrs":{"src":"/embed/youtube?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtrHMLJpxG7o"}}]}]&return_content=true

so, the part after /embed/youtube?url= should be used with encodeURIComponent function . Also, figure tag is mandataory as I understand

Answer was inspired from here: https://github.com/python273/telegraph/issues/5

Arron Stowne
  • 111
  • 3