aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/utils/embed.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/utils/embed.js')
-rw-r--r--vnext/src/utils/embed.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/vnext/src/utils/embed.js b/vnext/src/utils/embed.js
index 3020058a..514ce1ce 100644
--- a/vnext/src/utils/embed.js
+++ b/vnext/src/utils/embed.js
@@ -268,9 +268,14 @@ function getEmbeddableLinkTypes() {
name: 'Twitter',
id: 'embed_twitter_status',
className: 'twi compact',
- re: /^(?:https?:)?\/\/(?:www\.)?(?:mobile\.)?twitter\.com\/([\w-]+)\/status(?:es)?\/([\d]+)/i,
+ re: /^(?:https?:)?\/\/(?:www\.)?(?:mobile\.)?(twitter|x)\.com\/([\w-]+)\/status(?:es)?\/([\d]+)/i,
makeNode: function(aNode, reResult, div) {
- fetch('https://x.juick.com/oembed?url=' + reResult[0])
+ const wrong_prefix = 'https://x.com'
+ const correct_prefix = 'https://twitter.com'
+ const twitter_url = reResult[0].startsWith(wrong_prefix) ?
+ reResult[0].replace(wrong_prefix, correct_prefix)
+ : reResult[0]
+ fetch('https://x.juick.com/oembed?url=' + twitter_url)
.then(response => response.json())
.then(json => {
div.innerHTML = json.html