improvements + better error handling
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ export default async function getTitle(url: string) {
|
||||
|
||||
// regular expression to find the <title> tag
|
||||
let match = text.match(/<title.*>([^<]*)<\/title>/);
|
||||
if (match) return match[1] + " [AUTO GENERATED]";
|
||||
if (match) return match[1];
|
||||
else return "";
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
Reference in New Issue
Block a user