Problem/Motivation

Currently the Twitter media source plugin only accepts tweet from twitter.com domains.

 /**
   * List of validation regular expressions.
   *
   * @var array
   */
  public static $validationRegexp = [
    '@((http|https):){0,1}//(www\.){0,1}twitter\.com/(?<user>[a-z0-9_-]+)/(status(es){0,1})/(?<id>[\d]+)@i' => 'id',
  ];

Steps to reproduce

  1. Open https://twitter.com/Drupal in your browser
  2. Use share button below a state you want to share
  3. Copy link from popup of share button
  4. Investigate copied URL via curl -I command

Proposed resolution

Adjust regex rule to also allow adding tweets from x.com domains.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#9 3392584_add-x-com-link-support-8.patch1.69 KBgranik
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

IT-Cru created an issue. See original summary.

paulrad made their first commit to this issue’s fork.

paulrad’s picture

Assigned: Unassigned » paulrad

paulrad’s picture

Assigned: paulrad » Unassigned
Status: Active » Needs review

I've modified the regex check to work with both twitter.com and x.com links. But the issue i that we still don't have a Media oEmbed provider for the x.com. So to properly work with links from the new domain you should create your custom provider using the oEmbed Providers module or wait for the core's Twitter provider update.

it-cru’s picture

There is also an existing issue to support x.com in providers of oembed.com on Github.

https://github.com/iamcal/oembed/issues/710

kaszarobert’s picture

Status: Needs review » Needs work

And when the X oembed provider will be added to https://oembed.com/providers.json finally, the array in src/Plugin/media/Source/Twitter.php getProviders() function also needs to be changed to include the new X with the same provider_name, otherwise it won't work.

granik made their first commit to this issue’s fork.

granik’s picture

Status: Needs work » Needs review
StatusFileSize
new1.69 KB

@paulrad, thanks four your MR, I just added a commit, now it seems to work fine.
Btw, X is now in provider list, thanks for your note, @kaszarobert.

p.s. Also added a patch to use with composer for now.

styx1983’s picture

Status: Needs review » Reviewed & tested by the community

The patch provided in #9 works fine for me.

kaszarobert’s picture

Priority: Normal » Critical

Now that twitter.com site is being redirected and replaced with x.com, users will expect to embed new content with x.com URLs. Therefore I think this is a pretty important thing to merge this to the module ASAP.

lmoeni’s picture

I tested the patch from #9 which works fine. Thanks!
I agree with @kaszarobert that this should be published soon.

chr.fritsch made their first commit to this issue’s fork.

  • chr.fritsch committed 51cff0d8 on 8.x-2.x authored by paulrad
    Issue #3392584: Adjust regex rules to allow adding tweets from x.com...
chr.fritsch’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.