mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-07 05:01:36 +00:00
Basic error checking
This commit is contained in:
parent
c2ac1b2259
commit
9f5fa84f9a
9 changed files with 156 additions and 49 deletions
|
|
@ -1,3 +1,4 @@
|
|||
const constants = require("../constants")
|
||||
const {Parser} = require("./parser/parser")
|
||||
|
||||
/**
|
||||
|
|
@ -5,7 +6,8 @@ const {Parser} = require("./parser/parser")
|
|||
*/
|
||||
function extractSharedData(text) {
|
||||
const parser = new Parser(text)
|
||||
parser.seek("window._sharedData = ", {moveToMatch: true, useEnd: true})
|
||||
const index = parser.seek("window._sharedData = ", {moveToMatch: true, useEnd: true})
|
||||
if (index === -1) throw constants.symbols.NO_SHARED_DATA
|
||||
parser.store()
|
||||
const end = parser.seek(";</script>")
|
||||
parser.restore()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue