Skip to content

Commit

Permalink
Merge pull request #124 from Abhii5496/twitter-embed
Browse files Browse the repository at this point in the history
Replaced twittframe api with "Official twitter embed api"
  • Loading branch information
neSpecc committed Apr 8, 2024
2 parents a42087b + b6f7f96 commit dfdbf24
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Tool uses Editor.js pasted patterns handling and inserts iframe with embedded co
- [Facebook](https://www.facebook.com) - `facebook` service
- [Instagram](https://www.instagram.com/codex_team/) - `instagram` service
- [YouTube](https://youtube.com) - `youtube` service
- [Twitter](https://twitter.com/codex_team) - `twitter` service. (https://twitframe.com used for render)
- [Twitter](https://twitter.com) - `twitter` service. (official twitter api is used for render, no need to use twitframe)
- [Twitch](https://twitch.tv) - `twitch-video` service for videos and `twitch-channel` for channels
- [Miro](https://miro.com) - `miro` service
- [Vimeo](https://vimeo.com)`vimeo` service
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/embed",
"version": "2.7.0",
"version": "2.7.1",
"keywords": [
"codex editor",
"embed",
Expand Down Expand Up @@ -34,6 +34,7 @@
"email": "team@codex.so"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/register": "^7.22.15",
Expand Down
6 changes: 3 additions & 3 deletions src/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ export default {
width: 400,
},
twitter: {
regex: /^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+?.*)?$/,
embedUrl: 'https://twitframe.com/show?url=https://twitter.com/<%= remote_id %>',
regex: /^https?:\/\/(www\.)?twitter\.com\/.+\/status\/(\d+)/,
embedUrl: 'https://platform.twitter.com/embed/Tweet.html?id=<%= remote_id %>',
html: '<iframe width="600" height="600" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',
height: 300,
width: 600,
id: ids => ids.join('/status/'),
id: ids => ids[1],
},
pinterest: {
regex: /https?:\/\/([^\/\?\&]*).pinterest.com\/pin\/([^\/\?\&]*)\/?$/,
Expand Down
4 changes: 2 additions & 2 deletions test/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ describe('Services Regexps', () => {
const urls = [
{
source: 'https://twitter.com/codex_team/status/1202295536826630145',
embed: 'https://twitframe.com/show?url=https://twitter.com/codex_team/status/1202295536826630145'
embed: 'https://platform.twitter.com/embed/Tweet.html?id=1202295536826630145'
},
{
source: 'https://twitter.com/codex_team/status/1202295536826630145?s=20&t=wrY8ei5GBjbbmNonrEm2kQ',
embed: 'https://twitframe.com/show?url=https://twitter.com/codex_team/status/1202295536826630145?s=20&t=wrY8ei5GBjbbmNonrEm2kQ'
embed: 'https://platform.twitter.com/embed/Tweet.html?id=1202295536826630145'
},
];

Expand Down
Loading

0 comments on commit dfdbf24

Please sign in to comment.