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

asked Jun 22, 2020 at 0:44

1 Answer 1

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

answered May 8, 2021 at 19:46
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.