Comments (8)
@raae Sounds good! Thanks for following up on the issue on https://github.com/iamcal/oembed.
from gatsby-remark-oembed.
A new release does not fix Instagram, one has to add an access_token to the Setting to do so. See the updated readme.
I should of course also get on with making a new release as well. I might reach out to you to test the new release before releasing.
from gatsby-remark-oembed.
The deprecated endpoint has been removed (iamcal/oembed#515), it should be reflected in the provider list within an hour and Instagram embed should work again if you provide an access_token.
from gatsby-remark-oembed.
@YoranBrondsema I would like to do a complete refactor of the code you reference as this was my first ever node project and I have learned a lot since then. Therefore I do not think we need to update this now as all providers should have only one match for the foreseeable future.
However when I get around to diagramming the refactor and roadmap for this plugin I would love to have you contribute.
from gatsby-remark-oembed.
Yes please! Anything I can do to get the Instagram fix into a new release?
from gatsby-remark-oembed.
I see that the order of Instagram endpoints have been changed in the provider list this plugin rely on, meaning the deprecated endpoint is now favoured. I do not understand why it is in there at all, I will make a PR against @iamcal/oembed.
So even with adding an access_token it will be broken right now.
I am thinking more and more that I might need to keep my own vetted list, or get more involved with that repo as well.
from gatsby-remark-oembed.
I agree, it's confusing that in https://github.com/iamcal/oembed/blob/1db773d2665db51101776744f04a0a15b0086bdc/providers/instagram.yml a same URL can match multiple endpoints.
It does seem like the schemes in @iamcal/oembed are sorted by order of preference though. So the first match should be the "correct" one. If that's the assumption, then it would make sense to rewrite https://github.com/raae/gatsby-remark-oembed/blob/master/gatsby-remark-oembed/utils/getProviderEndpointForLinkUrl.js as:
const getProviderEndpointForLinkUrl = (linkUrl, providers) => {
for (const provider of providers || []) {
for (const endpoint of provider.endpoints || []) {
const isInstagram = provider.provider_name === "Instagram";
const hasAccessToken = provider.params && provider.params.access_token;
for (let schema of endpoint.schemes || []) {
schema = schema.replace("*", ".*");
const regExp = new RegExp(schema);
const isMatchingSchema = regExp.test(linkUrl);
if (isMatchingSchema && isInstagram && !hasAccessToken) {
throw new Error(
"Instagram require you to configure an access_token. For more information, visit https://developers.facebook.com/docs/instagram/oembed/."
);
} else if (isMatchingSchema) {
return {
url: endpoint.url,
params: {
url: linkUrl,
...provider.params
}
};
}
}
}
}
return {};
};
so return early as soon as a match is found. Would that make sense?
from gatsby-remark-oembed.
Working on it, help test the next version - see #159
from gatsby-remark-oembed.
Related Issues (20)
- Setup mdx example site to Netlify HOT 1
- Fix format command in gatsby-remark-oembed package folder HOT 2
- Add Instagram hack to get around access token requirement? HOT 6
- Something is up with Twitch embeds HOT 8
- Move Instagram throw error when finding an instagram embed HOT 2
- New release HOT 1
- Add pull request template
- Add mdx support documentation HOT 1
- Logo HOT 1
- Improve test coverage for tranformsLinkNodeToOembedNode.js
- Improve performance in `getProviderEndpointForLinkUrl` HOT 1
- Move to GitHub actions form Travis? HOT 1
- Use without Gatsby HOT 11
- Add pluginOptionsSchema
- trim option should exclude <pre> HOT 2
- Twitter Embed - Missing blockquote.twitter-tweet HOT 2
- Transforms links that are list items HOT 2
- Transforms links that are image links HOT 1
- The automated release is failing 🚨
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-remark-oembed.