Cleanup
This commit is contained in:
parent
420f953215
commit
196f318316
|
@ -125,7 +125,10 @@ module.exports = function dissectLink(url) {
|
|||
return hostMethod;
|
||||
}
|
||||
|
||||
const { hostname } = new UrlPattern('http(s)\\://(www.):hostname(*)').match(url);
|
||||
const match = new UrlPattern('http(s)\\://(www.):hostname(*)').match(url);
|
||||
|
||||
if (match) {
|
||||
const { hostname } = match;
|
||||
|
||||
if (hostname && fallbacks.has(hostname)) {
|
||||
return {
|
||||
|
@ -134,6 +137,9 @@ module.exports = function dissectLink(url) {
|
|||
label: hostname,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
console.log(url);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
const youtubedl = require('youtube-dl');
|
||||
const dateFns = require('date-fns');
|
||||
|
||||
async function tube(host) {
|
||||
async function tube(host, post) {
|
||||
try {
|
||||
const data = await new Promise((resolve, reject) => {
|
||||
youtubedl.getInfo(host.url, null, (error, info) => {
|
||||
if (error) {
|
||||
|
@ -14,6 +15,8 @@ async function tube(host) {
|
|||
});
|
||||
});
|
||||
|
||||
host.id = data.display_id;
|
||||
|
||||
return {
|
||||
album: null,
|
||||
items: [
|
||||
|
@ -28,6 +31,11 @@ async function tube(host) {
|
|||
},
|
||||
],
|
||||
};
|
||||
} catch (error) {
|
||||
console.log('\x1b[33m%s\x1b[0m', `Ignoring possible profile page '${host.url}' (${post ? post.permalink : 'no post'})`);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = tube;
|
||||
|
|
Loading…
Reference in New Issue