Closed Tormidal closed 2 years ago
Hello!
Can you please send the code example that causes this errors?
Also, please, clarify, what do you use as an argument for getImage
.
Of course!
the arguments are always in the form of the subreddit name(minus the r/; e.g. ecchi
or nekomimi
)
My nested calls looks like this:
async function getpic(fromSubreddit) {
console.log(`received ${fromSubreddit}`);
try {
const image = await getImage(fromSubreddit);
console.log(`retrieved pic at ${image}`);
return image;
} catch (error) {
console.log(error);
return error;
}
}
let image = '';
(async() => {
image = await getpic(categories[command][0]);
message.reply(image);
})();
console.log(`{LOG}User: ` + message.author.username + `, just used the ${command} command`);
return;
It works flawlessly until it hits these posts - which all seem to have non-standard characters.
Here's an example of this faulty result vs. a normal/working results(warning potentially nsfw: https://i.gyazo.com/46c93eaf5c01c30be540cba938d44f76.png)
@Tormidal, can you check out the 2.0.2-2
version (from #5) and see if the problem still persists?
@Tormidal, can you check out the
2.0.2-2
version (from #5) and see if the problem still persists?
Still persists on 2.0.2-2:
post was titled "Ägir in a Semi Bodysuit" but link shows as below "ägir_in_a_semi_bodysuit"
{ERROR}: caught error at FetchError: invalid json response body at https://www.reddit.com/r/AzurLewd/comments/ok4590/ägir_in_a_semi_bodysuit/.json?utm_campaign=redirect&utm_medium=desktop&utm_source=reddit&utm_name=random_link reason: Unexpected token < in JSON at position 0
Can't reproduce the bug in version 2.0.3. I consider it fixed since I don't use random.json
approach anymore and I just pick a random post from a list, therefore there should not be any problems with parsing a HTML as a JSON.
Hi!
I've noticed this happens on occasion: if this is an issue with node-fetch, feel free to call me and idiot and close this issue. :)
They mostly all seem to have non-standard characters in the URL; however the webpages and JSON source pages themselves are still accessible.