20 lines
418 B
TypeScript
20 lines
418 B
TypeScript
import * as cherrio from 'cheerio'
|
|
|
|
const getResource = (key: any, data: any) => {
|
|
const $ = cherrio.load(`<div class="">${data}</div>`)
|
|
let result = null;
|
|
switch (key) {
|
|
case 'HIGHLIGHT_VIDEO':
|
|
result = $('video').first().parent().html();
|
|
break;
|
|
default:
|
|
result = $.html();
|
|
}
|
|
console.log(result)
|
|
return result;
|
|
}
|
|
|
|
export {
|
|
getResource
|
|
}
|