|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
import { query } from '@ghostfolio/api/helper/object.helper'; |
|
|
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; |
|
|
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; |
|
|
import { |
|
|
import { |
|
|
DataProviderInterface, |
|
|
DataProviderInterface, |
|
|
@ -26,7 +27,6 @@ import { Injectable, Logger } from '@nestjs/common'; |
|
|
import { DataSource, SymbolProfile } from '@prisma/client'; |
|
|
import { DataSource, SymbolProfile } from '@prisma/client'; |
|
|
import * as cheerio from 'cheerio'; |
|
|
import * as cheerio from 'cheerio'; |
|
|
import { addDays, format, isBefore } from 'date-fns'; |
|
|
import { addDays, format, isBefore } from 'date-fns'; |
|
|
import * as jsonpath from 'jsonpath'; |
|
|
|
|
|
|
|
|
|
|
|
@Injectable() |
|
|
@Injectable() |
|
|
export class ManualService implements DataProviderInterface { |
|
|
export class ManualService implements DataProviderInterface { |
|
|
@ -286,9 +286,14 @@ export class ManualService implements DataProviderInterface { |
|
|
let value: string; |
|
|
let value: string; |
|
|
|
|
|
|
|
|
if (response.headers.get('content-type')?.includes('application/json')) { |
|
|
if (response.headers.get('content-type')?.includes('application/json')) { |
|
|
const data = await response.json(); |
|
|
const object = await response.json(); |
|
|
|
|
|
|
|
|
value = String(jsonpath.query(data, scraperConfiguration.selector)[0]); |
|
|
value = String( |
|
|
|
|
|
query({ |
|
|
|
|
|
object, |
|
|
|
|
|
pathExpression: scraperConfiguration.selector |
|
|
|
|
|
})[0] |
|
|
|
|
|
); |
|
|
} else { |
|
|
} else { |
|
|
const $ = cheerio.load(await response.text()); |
|
|
const $ = cheerio.load(await response.text()); |
|
|
|
|
|
|
|
|
|