[CORL-735] Scraper support for JSON Linked Data (#2671)

* feat: add support for application/json+ld parsing

- upgraded scraper packages to use new jsonld parser
- waiting on https://github.com/microlinkhq/metascraper/pull/225
  for merging
- fixes #2670

* chore: metascraper upgrades
This commit is contained in:
Wyatt Johnson
2019-10-24 16:08:15 +00:00
committed by GitHub
parent ac96e5e312
commit 5714f441bb
6 changed files with 601 additions and 149 deletions
+18 -10
View File
@@ -1,17 +1,21 @@
declare module "metascraper" {
export interface Scraper {
(
options: {
url: string;
html: string;
}
): Promise<Record<string, string | undefined>>;
(options: { url: string; html: string }): Promise<
Record<string, string | undefined>
>;
}
export type Rules = Record<
string,
Array<(options: { htmlDom: CheerioSelector }) => string | undefined>
>;
export type Ruler = (options: {
htmlDom: CheerioSelector;
url: string;
}) => string | undefined;
export type Rule = (
htmlDom: CheerioSelector,
url: string
) => string | undefined;
export type Rules = Record<string, Array<Ruler>>;
export function load(rules: Rules[]): Scraper;
}
@@ -40,3 +44,7 @@ declare module "metascraper-title" {
import { Rules } from "metascraper";
export default function def(): Rules;
}
declare module "@metascraper/helpers" {
export const $jsonld: any;
}