From ddea4a29e2e929998b2669937e3e14b71f824287 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 22 Feb 2021 11:16:19 +0100 Subject: [PATCH 1/2] Instagram: include query parameters in thumbnail URL Retrieval now fails without them with an error stating: 'Bad URL timestamp' Fixes #30 --- src/WebThumbnailer/resources/rules.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebThumbnailer/resources/rules.json b/src/WebThumbnailer/resources/rules.json index a0c3ea6..9612d85 100644 --- a/src/WebThumbnailer/resources/rules.json +++ b/src/WebThumbnailer/resources/rules.json @@ -194,7 +194,7 @@ "hotlink_allowed": true }, "rules": { - "image_regex": " Date: Mon, 22 Feb 2021 11:25:49 +0100 Subject: [PATCH 2/2] Update instagram unit test with current version of HTML content --- .../Finder/QueryRegexFinderTest.php | 12 +- .../instagram/instagram-picture.html | 516 +++++++++-------- .../instagram/instagram-profile.html | 521 ++++++++++-------- 3 files changed, 598 insertions(+), 451 deletions(-) diff --git a/tests/WebThumbnailer/Finder/QueryRegexFinderTest.php b/tests/WebThumbnailer/Finder/QueryRegexFinderTest.php index 9ccbb71..170028c 100644 --- a/tests/WebThumbnailer/Finder/QueryRegexFinderTest.php +++ b/tests/WebThumbnailer/Finder/QueryRegexFinderTest.php @@ -280,8 +280,10 @@ public function testQueryRegexImgurGallery() */ public function testQueryRegexInstagramPicture() { - $expected = 'https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/sh0.08/e35/p750x750/' - . '14719286_1129421600429160_916728922148700160_n.jpg'; + $expected = 'https://scontent-cdg2-1.cdninstagram.com/v/t51.2885-15/e35/' + . '14719286_1129421600429160_916728922148700160_n.jpg' + . '?_nc_ht=scontent-cdg2-1.cdninstagram.com' + . '&_nc_cat=100&_nc_ohc=xWaFFBqAj6wAX_gqYWt&tp=1&oh=dd77c7c72429d2db9ca3666f01c60e60&oe=605B2EDA'; $allRules = DataUtils::loadJson(FileUtils::RESOURCES_PATH . 'rules.json'); $rules = $allRules['instagram']['rules']; $options = $allRules['instagram']['options']; @@ -295,8 +297,10 @@ public function testQueryRegexInstagramPicture() */ public function testQueryRegexInstagramProfile() { - $expected = 'https://scontent-cdg2-1.cdninstagram.com/t51.2885-19/s150x150/' - . '11351823_506089142881765_717664936_a.jpg'; + $expected = 'https://scontent-cdg2-1.cdninstagram.com/v/t51.2885-19/s150x150/' + . '11351823_506089142881765_717664936_a.jpg' + . '?_nc_ht=scontent-cdg2-1.cdninstagram.com' + . '&_nc_ohc=US3NCxc_VOcAX-WwNIl&tp=1&oh=2bb367a88e579c411c7c484fcc6b1e3e&oe=605C8165'; $allRules = DataUtils::loadJson(FileUtils::RESOURCES_PATH . 'rules.json'); $rules = $allRules['instagram']['rules']; $options = $allRules['instagram']['options']; diff --git a/tests/WebThumbnailer/resources/instagram/instagram-picture.html b/tests/WebThumbnailer/resources/instagram/instagram-picture.html index 8e03e7a..616a25e 100644 --- a/tests/WebThumbnailer/resources/instagram/instagram-picture.html +++ b/tests/WebThumbnailer/resources/instagram/instagram-picture.html @@ -1,144 +1,32 @@ - - - - + - - - - Instagram + Awesome colourful nature on Instagram: “Photo by @dominicliam” - - - - - - - - - - - + + - - - + + + + + + + + + + + + + - + + + + + + + + + - - - - - - - + + - + - - - + + + + @@ -184,97 +183,168 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - \ No newline at end of file + + diff --git a/tests/WebThumbnailer/resources/instagram/instagram-profile.html b/tests/WebThumbnailer/resources/instagram/instagram-profile.html index 6db5983..f9dbf2a 100644 --- a/tests/WebThumbnailer/resources/instagram/instagram-profile.html +++ b/tests/WebThumbnailer/resources/instagram/instagram-profile.html @@ -1,144 +1,32 @@ - - - - + - - - - Awesome colourful nature (@fantastic.colours) • Photos et vidéos Instagram + Awesome colourful nature (@fantastic.colours) • Instagram photos and videos - - - - - - - - - - - + + - - - + + + + + + + + + + + + + - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + - - - - - - \ No newline at end of file + +