Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
From https://developers.facebook.com/docs/instagram/oembed:
This document explains how to use the new Instagram oEmbed endpoint. This endpoint is replacing Instagram's Legacy oEmbed endpoints, which will be deprecated on October 24, 2020.
If you are migrating off of the legacy endpoints, make sure to read this document in its entirety since the endpoint paths and their requirements have changed.
This means the module will need updating to handle the new API.
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff-3163542-7-10.txt | 7.86 KB | chr.fritsch |
#10 | 3163542-10.patch | 56.31 KB | chr.fritsch |
| |||
#7 | 3163542-7.patch | 53.56 KB | chr.fritsch |
| |||
#5 | 3163542.patch | 50.56 KB | chr.fritsch |
| |||
#3 | diff.patch | 4.54 KB | patrick_mcdougle |
Comments
Comment #2
patrick_mcdougleYeah, this is going to be tricky since the new endpoint isn't unauthenticated and requires a facebook app / developer account / graph API access.
Comment #3
patrick_mcdougleHere's a start. Lots more to do, but it's a start. Anyone should feel comfortable applying the patch onto their own branch and take development from here. I don't know if I will ever spend the time required to get this all the way working. It's basically a port of some code I wrote for work and thought I could share with the community.
Comment #4
chr.fritschThx for starting this. I've seen that @patrick_mcdougle already added a PR for oembed.com. (https://github.com/iamcal/oembed/pull/470)
I think when we have to reimplement the API, it would be nice if we could use as much as possible from drupal core's oEmbed implementation.
Comment #5
chr.fritschSo here is my proposal. The plan is to get this committed to 3.x soon.
Comment #6
patrick_mcdougleThat patch looks good to me (code reviewed, but not run), this is arguably better than the direction I was running with. Happy to see that you were able to eliminate some of the cruft and utilize more of the core functionality.
The other thing that we should eventually think about is how to help people transition from v2 to v3 so that things won't break when they upgrade. Was this transition smooth for you? Was it as easy as just replacing the code, or did it break old Instagram Oembeds that were created from v2?
I wish the interfaces in the oembed core component were a little better. It'd be great if the providers could handle their own fetching logic (or fall back to a default one as it does now) as opposed to just brokering endpoints / url building, but that's a fight for another day...
Comment #7
chr.fritschHere is an improved patch that:
- Adds the source as a class instead of the alter hook. This has the advantage that we can remove the fields that are not supported by the graph api
- Adds an update hook
Comment #8
patrick_mcdougleOne thing that we COULD do instead would be override the media type class. Following the example from the top of the OEmbed class...
This way we can extend Core's Oembed class, but rewrite the parts that need re-writing. (Including possibly putting the fb app id / secret on the media type config as opposed to the config of this module).
Comment #9
volkerk CreditAttribution: volkerk at Thunder commentedLooks like a nice simple approach.
Found a few issues tough:
1. Add descriptive error message in hook_oembed_resource_url_alter() implementation, when facebook credentials are not set, currently it fails with "Could not retrieve the oEmbed resource".
2. Add configure link to module page and readme.
3. Thumbnails only work when using core patch from #3071760: [backport] oEmbed system does not remove query strings from local thumbnail filenames.
4. Display of instagram posts is broken; two iframes (.media-oembed-content and .instagram-media) are nested and height is always 150px.
5. In getMetadata() some effort is made to provide a reasonable 'default_name', but default_name_metadata_attribute is set to author_name in annotation.
Comment #10
chr.fritschThanks for the review.
I think I addressed all your concerns. Regarding number 4:
I added back the instagram formatter, we had before because Instagram returns an object without a height and the core formatter can not handle that. I know this is kinda insecure, but I don't see another way to fix this.
Comment #11
chr.fritschHere is the interdiff
Comment #12
volkerk CreditAttribution: volkerk at Thunder commentedI found another issue which is addressed by #3168301: oEmbed validator should use the urlResolver to get the resource URL.
Anyway this one here looks good to go.
Comment #13
volkerk CreditAttribution: volkerk at Thunder commentedComment #14
chr.fritschCommitted as 3.x
Comment #16
finaukaufusi CreditAttribution: finaukaufusi commentedHi guys, thanks for providing this patch. Is there're path to backport this patch to work on Drupal 8.6.x instead of Drupal 8.8 and above?
Comment #17
dpid.o didnt link the commit because of the new branch, the commit is here for those looking:
https://git.drupalcode.org/project/media_entity_instagram/-/commit/527a0...