parser icon indicating copy to clipboard operation
parser copied to clipboard

TypeError: $.html is not a function

Open ShokorV8 opened this issue 4 years ago • 2 comments

  • Platform: Linux 4.15.0-99-generic Ubuntu x86_64 GNU/Linux
  • Mercury Parser Version: "@postlight/mercury-parser": "^2.2.0"
  • Node Version (if a Node bug):
  • Browser Version (if a browser bug):

Expected Behavior

when calling mercury parser either through CLI or node on certain urls it should successfully parse them

Current Behavior

instead the parser simply throws the following exception stack

TypeError: $.html is not a function
    at _callee$ (/usr/local/lib/node_modules/@postlight/mercury-parser/dist/mercury.js:7554:22)
    at tryCatch (/usr/local/lib/node_modules/@postlight/mercury-parser/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/@postlight/mercury-parser/node_modules/regenerator-runtime/runtime.js:274:22)
    at Generator.prototype.<computed> [as next] (/usr/local/lib/node_modules/@postlight/mercury-parser/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/usr/local/lib/node_modules/@postlight/mercury-parser/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:5:24)
    at _next (/usr/local/lib/node_modules/@postlight/mercury-parser/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js:27:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Steps to Reproduce

simply calling the CLI parser on the following example link can reproduce the issue. example

Detailed Description

Possible Solution

ShokorV8 avatar May 19 '20 03:05 ShokorV8

Same problem

keery avatar Jan 25 '21 15:01 keery

I ran into this same issue. I have no solution, but I did notice that it was happening when trying to load the next page and running into 400 response for the next page, rather than a 200. I was able to get it to at least not fail completely when using the undocumented fetchAllPages option.

For example:

Mercury.parse(null, { contentType: 'markdown', fetchAllPages: false })

rothnic avatar May 06 '21 17:05 rothnic