Browse Source

Yarn format

pull/2810/head
Hugo Persson 2 years ago
committed by Thomas Kaul
parent
commit
0ce4f0d9fd
  1. 8
      apps/api/src/services/data-provider/manual/manual.service.ts
  2. 3
      apps/api/src/services/symbol-profile/symbol-profile.service.ts

8
apps/api/src/services/data-provider/manual/manual.service.ts

@ -20,7 +20,7 @@ import { isUUID } from 'class-validator';
import { addDays, format, isBefore } from 'date-fns';
import got, { Headers } from 'got';
import { ScraperConfiguration } from '@ghostfolio/common/interfaces';
import jsonpath from "jsonpath";
import jsonpath from 'jsonpath';
@Injectable()
export class ManualService implements DataProviderInterface {
@ -234,7 +234,6 @@ export class ManualService implements DataProviderInterface {
abortController.abort();
}, this.configurationService.get('REQUEST_TIMEOUT'));
const { body } = await got(config.url, {
headers: config.headers as Headers,
// @ts-ignore
@ -244,13 +243,10 @@ export class ManualService implements DataProviderInterface {
const data = JSON.parse(body);
const field = String(jsonpath.query(data, config.selector)[0]);
return extractNumberFromString(field);
}
else{
} else {
const $ = cheerio.load(body);
return extractNumberFromString($(config.selector).first().text());
}
} catch (error) {
throw error;
}

3
apps/api/src/services/symbol-profile/symbol-profile.service.ts

@ -204,7 +204,8 @@ export class SymbolProfileService {
scraperConfiguration.headers as ScraperConfiguration['headers'],
selector: scraperConfiguration.selector as string,
url: scraperConfiguration.url as string,
type: (scraperConfiguration.type ?? "html") as ScraperConfiguration['type']
type: (scraperConfiguration.type ??
'html') as ScraperConfiguration['type']
};
}

Loading…
Cancel
Save