Add more output to debug.txt
This commit is contained in:
parent
04b22fdce5
commit
817843c40c
12
src/batch.ts
12
src/batch.ts
@ -77,7 +77,11 @@ export default function(args: string[], done: (err?: Error) => void)
|
||||
{
|
||||
if (tasksArr[i].retry <= 0)
|
||||
{
|
||||
console.error(errin);
|
||||
log.error(errin.stack || errin);
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('BatchGiveUp', errin.stack || errin);
|
||||
}
|
||||
log.error('Cannot get episodes from "' + tasksArr[i].address + '", please rerun later');
|
||||
/* Go to the next on the list */
|
||||
i += 1;
|
||||
@ -86,7 +90,11 @@ export default function(args: string[], done: (err?: Error) => void)
|
||||
{
|
||||
if (config.verbose)
|
||||
{
|
||||
console.error(errin);
|
||||
log.error(errin);
|
||||
}
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('BatchRetry', errin.stack || errin);
|
||||
}
|
||||
log.warn('Retrying to fetch episodes list from' + tasksArr[i].retry + ' / ' + config.retry);
|
||||
tasksArr[i].retry -= 1;
|
||||
|
||||
@ -277,10 +277,21 @@ function scrapePage(config: IConfig, address: string, done: (err: Error, page?:
|
||||
const episodeTitle = $('#showmedia_about_name').text().replace(/[“”]/g, '');
|
||||
const data = regexp.exec(look);
|
||||
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('episode page', $.html());
|
||||
}
|
||||
|
||||
if (!swf || !data)
|
||||
{
|
||||
log.warn('Somethig unexpected in the page at ' + address + ' (data are: ' + look + ')');
|
||||
log.warn('Setting Season to ’0’ and episode to ’0’...');
|
||||
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('episode unexpected', look);
|
||||
}
|
||||
|
||||
done(null, {
|
||||
episode: '0',
|
||||
id: epId,
|
||||
@ -367,6 +378,11 @@ function scrapePlayer(config: IConfig, address: string, id: number, done: (err:
|
||||
});
|
||||
} catch (parseError)
|
||||
{
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('player scrape', parseError);
|
||||
}
|
||||
|
||||
done(parseError);
|
||||
}
|
||||
});
|
||||
|
||||
@ -51,6 +51,11 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
|
||||
let i = 0;
|
||||
(function next()
|
||||
{
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('Episode ' + i, JSON.stringify(page.episodes[i]));
|
||||
}
|
||||
|
||||
if (i >= page.episodes.length) return done(null);
|
||||
download(cache, config, address, page.episodes[i], (errD, ignored) =>
|
||||
{
|
||||
@ -166,6 +171,11 @@ function page(config: IConfig, address: string, done: (err: Error, result?: ISer
|
||||
const $ = cheerio.load(result);
|
||||
const title = $('span[itemprop=name]').text();
|
||||
|
||||
if (config.debug)
|
||||
{
|
||||
log.dumpToDebug('serie page', $.html());
|
||||
}
|
||||
|
||||
if (!title) {
|
||||
if (config.debug)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user