Changed scene fetch title source for BlowPass scraper.

This commit is contained in:
ThePendulum 2019-04-10 04:44:36 +02:00
parent 52fca94b22
commit 82419be402
5 changed files with 28 additions and 2 deletions

13
package-lock.json generated
View File

@ -5407,6 +5407,11 @@
"tweetnacl": "~0.14.0"
}
},
"stackback": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
"integrity": "sha1-Gsig2Ug4SNFpXkGLbQMaPDzmjjs="
},
"static-extend": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@ -6041,6 +6046,14 @@
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
},
"why-is-node-running": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.1.0.tgz",
"integrity": "sha512-oLmJ1uZOaKra+GDmYcUHMnVhi4CnZnlt4IE3J05ZDSEAiejeB5dMoR4a4rGcMWRy1Avx24dGTw8yxJ/+EmwPBQ==",
"requires": {
"stackback": "0.0.2"
}
},
"wide-align": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",

View File

@ -53,6 +53,7 @@
"sqlite3": "^4.0.6",
"tough-cookie": "^3.0.1",
"tty-table": "^2.7.0",
"why-is-node-running": "^2.1.0",
"yargs": "^13.2.2"
}
}

View File

@ -1,5 +1,6 @@
'use strict';
const log = require('why-is-node-running');
const blessed = require('neo-blessed');
const clipboard = require('clipboardy');
@ -41,7 +42,7 @@ function getMethod() {
}
async function init() {
const screen = argv.render && initScreen();
const screen = argv.render && !argv.filename && initScreen();
try {
const method = getMethod();
@ -52,6 +53,13 @@ async function init() {
console.log(`Result copied to clipboard: ${result.copy}`);
}
if (argv.filename && result.filename) {
console.log(result.filename);
setTimeout(() => log(), 5000);
return;
}
if (argv.render) {
method.render(result, screen);
}

View File

@ -39,6 +39,10 @@ const { argv } = yargs
type: 'boolean',
alias: 'c',
})
.option('filename', {
describe: 'Only output the suggested filename of a scene',
type: 'boolean',
})
.option('debug', {
describe: 'Show error stack traces',
type: 'boolean',

View File

@ -46,7 +46,7 @@ async function scrapeScene(html, url, site) {
const workName = data.isPartOf.name.split(' - ');
const shootId = workName.length > 1 ? workName[0] : null;
const entryId = url.split('/').slice(-1)[0];
const title = data.name;
const title = data.isPartOf ? data.isPartOf.name : data.name;
const { description } = data;
const date = moment.utc(data.isPartOf.datePublished, 'YYYY-MM-DD').toDate();