I need to get the image urls from imgur post urls.
The urls of the posts looks like this: https://i.stack.imgur.com/LPmGJ.jpg
But the image urls look like this: https://i.stack.imgur.com/HyVaJ.jpg
I tryed it with the web-scraping library x-ray js but for some reason it doesn't work. For some reason I just get an empty array.
My code (I use Firebase Cloud Functions):
var Xray = require('x-ray');
exports.getImgurLink = functions.https.onCall(async (data, context) => {
var xray = Xray();
xray('https://imgur.com/a/1QEKZ2f', '.image-placeholder')(function (err, res) {
console.log("res: "+res);
})
});
I have the idea with the xray from this Post: Make imgur link have .png or .jpg in the end of the url with nodeJS but it is already older so I am not sure if it still works.
Can someone show me another method to get image urls from imgur or how to fix my xray code?
Thank you for your time.