It takes 60-70 seconds to say invalid hive post
Is there a better way to find if a permlink is valid or not? It takes 75 seconds to 80 seconds to find it.
var dhive = require("@hiveio/dhive");
var client = new dhive.Client([
"https://api.deathwing.me",
"https://hive-api.arcange.eu",
"https://hived.emre.sh",
"https://api.openhive.network",
"https://rpc.ausbit.dev",
"https://rpc.mahdiyari.info",
"https://hive-api.3speak.tv",
"https://techcoderx.com",
]);
async function isValidHiveContent(permlink) {
const permlinkValue = permlink.split("/")[1];
const author = permlink.split("/")[0];
console.log(Date.now());
try {
const data = await client.call("condenser_api", "get_content", [
author,
permlinkValue,
]);
console.log(Date.now());
return data != null;
} catch (e) {
console.log(Date.now());
return false;
}
}
async function getContent() {
const isvalidHiveContent = await isValidHiveContent("kaboom/boomboomboom");
console.log(`Is valid hive content - ${isvalidHiveContent}`);
}
getContent();