mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-22 00:46:37 +08:00
69cd00d1a4
* feat(route): add LiSA * Add a linebreak before next heading Co-authored-by: Tony <TonyRL@users.noreply.github.com> * fix title Co-authored-by: Tony <TonyRL@users.noreply.github.com> * use art-template * fix docs link * rename folder * fix router url according to new folder name * fix router path & example path in doc * append radar detectable source * Update lib/v2/lxixsxa/templates/disco.art Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/lxixsxa/templates/info.art Co-authored-by: Weijian Li <ri1ken@r1ks-mba.local>
20 lines
550 B
JavaScript
20 lines
550 B
JavaScript
function parseJSONP(jsonpData) {
|
|
try {
|
|
const startPos = jsonpData.indexOf('({');
|
|
const endPos = jsonpData.lastIndexOf('})');
|
|
let jsonString = jsonpData.substring(startPos + 1, endPos + 1);
|
|
|
|
// remove escaped single quotes since they are not valid json
|
|
jsonString = jsonString.replace(/\\'/g, "'");
|
|
|
|
return JSON.parse(jsonString);
|
|
} catch (e) {
|
|
const error = new Error(`Failed to convert jsonp to json. ${e.message}`);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
parseJSONP,
|
|
};
|