question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong parsing of <title>

See original GitHub issue

Thank you very much for this great library, seems to work well, I’m currently testing it.

However:

unfurl.js will parse the title of https://hash.ai as “Facebook”.

Reason:

This is the correct title and it appears first:

Screenshot 2021-05-25 at 21 55 53

but later on there is more stuff with <title> and what unfurl parses is the last one:

Screenshot 2021-05-25 at 21 55 41

This works correctly:

https://github.com/wzbg/read-title/blob/master/index.js

would it be possible to do it this way in your library?

Can it be done easily / soon ? If not, if you could please explain if you see this as an issue or not … I’ll think more about it and possibly fork + implement a fix myself… if there are any guidelines for me to adhere to for the fix to have a better chance of being accepted upstream, also let me know… I’m not yet versed in typescript so the code might not be the best…

I hope it will be possible to do something in some way, so… thank you for the feedback / thoughts on this. david

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
davidhqcommented, May 27, 2021

tnx! it seems to work for this case. Didn’t notice other issues for now.

0reactions
jacktuckcommented, May 26, 2021

Should be fixed now. It’s not a very thorough fix so might need looking at again if other edge cases come up around this.

❯ yes | npx ts-node -e "require('./src/index.ts').unfurl('https://hash.ai').then(console.log)"
npm WARN exec The following package was not found and will be installed: ts-node
{
  title: 'HASH - Complex Systems Simulation',
  twitter_card: {
    card: 'summary_large_image',
    site: '@hashintel',
    title: 'HASH - Complex Systems Simulation',
    description: 'Build simulations in minutes not days. HASH is an open-source platform backed and built by the founders of Kaggle, Stack Overflow, Trello and Glitch.',
    images: [ [Object] ]
  },
  open_graph: {
    url: 'https://hash.ai/hash.ai',
    title: 'HASH - Complex Systems Simulation',
    description: 'Build simulations in minutes not days. HASH is an open-source platform backed and built by the founders of Kaggle, Stack Overflow, Trello and Glitch.',
    images: [ [Object] ]
  },
  description: 'Build simulations in minutes not days. HASH is an open-source platform backed and built by the founders of Kaggle, Stack Overflow, Trello and Glitch.',
  favicon: 'https://hash.ai/assets/img/brand/favicon-192.png'
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error parsing attribute 'title': The 'title' property is read-only and ...
The specific error I am getting is: Error parsing attribute 'title': The 'title' property is read-only and cannot be set. The error page...
Read more >
Error parsing commandline option Title #1085 - GitHub
Executed a search and wanted to play a song. It didn't play and it gave this error. Issue / Suggestion. Exiting... (Fatal error)...
Read more >
Error while parsing file 'attribute "value" not allowed here
It is possible to fix this issue from using either a professional ebook editor (we recommend Sigil, as it is free to use)...
Read more >
Parse error - Codecademy
My code passes and allows me to proceed, but I've had a "parse" error for a few lessons. Can someone help me figure...
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
What went wrong? JSON. parse() parses a string as JSON. This string has to be valid JSON and will throw this error if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found