mirror of
https://github.com/wassname/talk.git
synced 2026-08-07 11:29:44 +08:00
[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:
Vendored
+18
-10
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user