Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#53448 closed enhancement (fixed)

Add Pinterest as a whitelisted oEmbed provider

Reported by: pento's profile pento Owned by: pento's profile pento
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Embeds Keywords: has-patch needs-docs has-dev-note
Focuses: Cc:

Description

I'd like to propose that we add Pinterest as a trusted oEmbed provider.

They provide a single oembed endpoint, which handles URLs of pins, boards, and profiles.

To answer questions listed in the trusted oEmbed provider handbook page:

Is the service popular enough for core developers to have heard of it before? Is it “mainstream?”

Yes, definitely.

If similar services are already supported, how does this service compare in terms of size, features, and backing?

I don't believe we currently have a favourite-ing service on the list of trusted providers.

Does this service have a large following on Twitter, Facebook, or other social media? Is its Twitter account verified?

Yep.

Is its oEmbed endpoint clearly established and properly documented? (Sometimes, they are just a developer’s pet project that may not be supported.)

I'm not aware of any documentation for the endpoint.

Does the oEmbed endpoint work with WordPress’ oEmbed auto-discovery? If not, could it be made to work with additional HTML tags or attributes being whitelisted?

Interestingly, while they do offer auto-discovery, WordPress doesn't support it. The oEmbed spec allows auto-discovery to be defined in <link> tags, or in Link HTTP headers: WordPress checks for the tags, but not the headers.

There's potentially an argument to be made for adding support for auto-discovery through headers, but since this is the first service I've ever seen that uses it, I would see that as a fairly low priority.

Does the service make an effort to build relationships with developers, such as through robust APIs?

The provide a handful of relevant APIs and documentation.

How old is the service?

11 years old.

Does it have a well-established Wikipedia article? (Seriously.)

Yes.

Has anyone written a WordPress plugin that leverages the service in some way, whether adding it as an oEmbed provider, creating a shortcode, or leveraging other APIs of the service? Do these plugins have any noticeable adoption or traction that would indicate usage and demand?

There are a bunch of relevant plugins, though it's usually bundled in with other social network support. Notably, Jetpack includes a Pinterest block that sees a decent amount of usage.

Is the provider frequently proposed?

This is the first proposal that I'm aware of.

Attachments (3)

53448.patch (1.1 KB) - added by ayeshrajans 3 years ago.
Adding a rudimentary patch with the URL match pattern and the changelog entry.
53448-2.patch (1.1 KB) - added by ayeshrajans 3 years ago.
Ignore the last one please :) This is the good one, I promise.
53448-3.patch (1.2 KB) - added by ayeshrajans 3 years ago.

Download all attachments as: .zip

Change History (11)

#1 @ayeshrajans
3 years ago

I think it makes sense to add them, and I'm honestly surprised WordPress doesn't support them already. I will work on a quick implementation.

@ayeshrajans
3 years ago

Adding a rudimentary patch with the URL match pattern and the changelog entry.

@ayeshrajans
3 years ago

Ignore the last one please :) This is the good one, I promise.

#2 @pento
3 years ago

Thanks for the patch, @ayeshrajans!

Pinterest redirect visitors to local domains (eg, if I visit this profile, I'm redirected to the Australian domain). I've asked some Pinterest engineers if they can provide a list of domains for us to match aginst.

#3 @pento
3 years ago

  • Keywords has-patch needs-refresh added; needs-patch removed

Here's a full list of the top level Pinterest domains:

www.pinterest.com
ar.pinterest.com
www.pinterest.com.au
co.pinterest.com
cz.pinterest.com
fi.pinterest.com
gr.pinterest.com
hu.pinterest.com
in.pinterest.com
id.pinterest.com
www.pinterest.com.mx
nl.pinterest.com
no.pinterest.com
pl.pinterest.com
ro.pinterest.com
sk.pinterest.com
za.pinterest.com
tr.pinterest.com

@ayeshrajans: are you able to update the patch to only match these domains? It should look something similar to the Amazon domain matches.

#4 @ayeshrajans
3 years ago

  • Keywords needs-refresh removed

Thanks for the list @pento.
I'd suggest this regex:

#https?://(?:[a-z]{2}|www)\.pinterest\.com(?:\.(?:au|mx))?/pin/\d+#i

This should allow all 2-letter sub domains or www, so it should be future-proof in case they add new local sub domains in the future. It isn't safe to assume all ccTLDs belong to Pinterest, so we only allow .com, .com.au, and .com.mx. All these followed by pin/\d+ pattern as the last patch.

@ayeshrajans
3 years ago

#5 @pento
3 years ago

Thank you for that, @ayeshrajans! I'll get this committed, with a couple of small changes:

  • Remove the non-capture group markers, to match other regexes: they make the regex a little harder to read.
  • Remove the pin/\d+ part of the pattern, other URLs can also be embedded (eg, profiles).

#6 @pento
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 51821:

Embeds: Add Pinterest as a trusted oEmbed provider.

Props ayeshrajans, pento.

Fixes #53448.

#7 @audrasjb
3 years ago

  • Keywords needs-docs needs-dev-note added

Adding this to to New oEmbed providers dev note for 5.9.
Needs to be mentioned on HelpHub as well.

#8 @audrasjb
3 years ago

  • Keywords has-dev-note added; needs-dev-note removed
Note: See TracTickets for help on using tickets.