This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export type Obj = Record<any, any>; | |
| export const isArray = Array.isArray; | |
| export const isObject = (val: unknown): val is Obj => { | |
| return val !== null && typeof val === 'object'; | |
| }; | |
| export type StrapiAttributesObject = { | |
| attributes: any; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { JSDOM } = require('jsdom') | |
| const { compact, expand, frame } = require('jsonld') | |
| const url = 'https://www.bbc.co.uk/schedules/p00fzl6p/2020/06/14' | |
| // fetch and parse HTML | |
| const { window: { document } } = await JSDOM.fromURL(url) | |
| // select the script elements containing JSON-LD | |
| const elements = document.querySelectorAll('script[type="application/ld+json"]') |
OlderNewer