From e253f312a68857ec316c2d021fb8cd0f206cdb41 Mon Sep 17 00:00:00 2001 From: Jeremy Mahieu Date: Mon, 6 Apr 2020 14:44:17 +0200 Subject: [PATCH] Make tiktok regex more specific --- js/plugins.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/plugins.js b/js/plugins.js index 038f260..8218f78 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -558,12 +558,14 @@ plugins.factory('userPlugins', function() { * Very similar to twitter */ var tikTokPlugin = new UrlPlugin('TikTok', function(url) { - var regex = /^https?:\/\/(www\.)?tiktok\.com\/(.+)/i, + var regex = /^https?:\/\/(www\.)?tiktok\.com\/@(.+)\/video\/(.+)/i, match = url.match(regex); if (match) { return function() { + var element = this.getElement(); + fetch("https://www.tiktok.com/oembed?url=" + url) .then(function(response) { return response.json(); @@ -573,7 +575,6 @@ plugins.factory('userPlugins', function() { var scriptIndex = data.html.indexOf("