From 0377053d5abf64ab8e4921c287c5b0343bdcbfa6 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 11 Sep 2024 05:16:56 +0200 Subject: [PATCH] Allowing for -mobile gfycat links, simplified URL patterns --- src/app.js | 1 - src/dissectLink.js | 12 ++---------- src/methods/imgurImage.js | 2 ++ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/app.js b/src/app.js index 8a0dd97..7d6d1c7 100644 --- a/src/app.js +++ b/src/app.js @@ -76,7 +76,6 @@ function fetchSavePosts(userPosts, ep) { async function initApp() { try { - klsjdflkjs const userPosts = await getCompleteUserPosts(); const ep = new exiftool.ExiftoolProcess(exiftoolBin); diff --git a/src/dissectLink.js b/src/dissectLink.js index b104e8d..ef61914 100644 --- a/src/dissectLink.js +++ b/src/dissectLink.js @@ -21,11 +21,7 @@ const hosts = [{ }, { method: 'imgurImage', label: 'imgur', - pattern: new UrlPattern('http(s)\\://(:subdomain.)imgur.com/:id_d(.:ext)(?*)'), -}, { - method: 'imgurImage', - label: 'imgur', - pattern: new UrlPattern('http(s)\\://(:subdomain.)imgur.com/:id(.:ext)(?*)'), + pattern: new UrlPattern('http(s)\\://(:subdomain.)imgur.com/(:id_d)(:id)(.:ext)(?*)'), }, { method: 'imgurAlbum', label: 'imgur', @@ -45,11 +41,7 @@ const hosts = [{ }, { method: 'gfycat', label: 'gfycat', - pattern: new UrlPattern('http(s)\\://(:server.)gfycat.com/:id(-size_restricted.gif)'), -}, { - method: 'gfycat', - label: 'gfycat', - pattern: new UrlPattern('http(s)\\://(:server.)gfycat.com/(gifs/detail/):id(.:ext)'), + pattern: new UrlPattern('http(s)\\://(:server.)gfycat.com/(gifs/detail/)(:id-mobile)(:id-size_restricted)(:id)(.:ext)'), }, { method: 'eroshareAlbum', label: 'eroshare', diff --git a/src/methods/imgurImage.js b/src/methods/imgurImage.js index 29227bc..b839064 100644 --- a/src/methods/imgurImage.js +++ b/src/methods/imgurImage.js @@ -3,6 +3,8 @@ const fetch = require('node-fetch'); async function imgurImage(post) { + console.log(post.host); + const res = await fetch(`https://imgur.com/${post.host.id}`); const html = await res.text();