Open onigetoc opened 1 year ago
Thank you for your suggestion. My lib only focuses on the oembed api, and does not extract meta tag from the webpage, so it does not support something like twitter cards or open graph properties. But I may consider to implement that in the future.
I may suggest adding the most important one like Facebook post, videos ect. These Facebook feeds have to be from accounts and page public with no sharing and view restriction. Published to all. To view to post only it's like Twitter, clicking the post time. https://developers.facebook.com/docs/plugins/embedded-posts/ https://developers.facebook.com/docs/plugins/embedded-video-player/
Twitter already work well.
I think if you find the right id it will work. But i think that some meta should be read like title, description ect. for Facebook there's something to modify if it's video post ect.
IFRAME:
Post:
<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2F20531316728%2Fposts%2F10154009990506729%2F&width=500&show_text=false&height=292&appId" width="500" height="292" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>
Video:
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F&width=500&show_text=true&height=371&appId" width="500" height="371" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" allowFullScreen="true"></iframe>
The Oembed json file will have to be done reading the header meta i guest. I already did that in the past but in php.
UPDATE: I did some test and i think it may not work because with JavaScript you are not logged in. mmm.... May be with node... i don't know.
But my own php version give me this:
With Facebook and Instagram, this lib requires to set app id and client token, as the doc here. I'm not sure that we can read these data without credentials.
For Facebook, it will work with public post (My result confirm it work with php). I do not know if it will work with javascript and node.
Example from NBC SPORT: https://oscarotero.com/embed3/demo/index.php?url=https://www.facebook.com/NBCSports/videos/272467038989271/
Same with normal posts:
@onigetoc what it showed is not oembed data but come from the webpage's meta tags. It find the oembed url but could not load the oembed without credentials.
My oembed-extractor follows oEmbed standard:
oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.
So I don't have plan to parse the meta data from target page. I may create another project for that purpose in the future and this lib can use that package as a dependency.
Some other services would work without explicitly being added to the list of providers should you implement oEmbed's method of discovery. For example, that bitchute page has discoverable oEmbed data.
@CorySanin yeah, this is a great suggestion.
Some work on some Oembed on node project lie (node-oembed), and some do not work from your's. This one work with:
Not working with oembed-extractor:
for example: this one do not work with oembed but work on your's [oembed-extractor].
With PHP i used this one and it's really good. May be your can be inspired to custom some to make many more to work. https://github.com/oscarotero/Embed/ I suggested him to add: Pinterest and some more. I customized some myself to add more providers with a embed service but without Oembed infos in the header. like - https://www.bitchute.com/video/8hXWnkvA8Ao/
Check for code or iframe: