Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Support HTML/rich text descriptions for audiobooks #1820

Closed
Demian98 opened this issue Jun 5, 2023 · 7 comments · Fixed by #3880 · May be fixed by #2176
Closed

[Enhancement] Support HTML/rich text descriptions for audiobooks #1820

Demian98 opened this issue Jun 5, 2023 · 7 comments · Fixed by #3880 · May be fixed by #2176
Labels
awaiting release Issue is resolved and will be in the next release enhancement New feature or request

Comments

@Demian98
Copy link
Contributor

Demian98 commented Jun 5, 2023

Describe the issue

Metadata fetching from audible is working and a great feature. But there is an issue with the comment field, that contains the description of the book.

The comments fetched from audible are loosing all their line breaks, which makes the text harder to read. Hopefully an easy that can improve the ABS even more :)

Steps to reproduce the issue

  1. Fetch metadata (including comment) for an audiobook from audible.
  2. Compare the text from the audible website with the text in ABS.
  3. You will notice, that the line breaks are missing.

Audiobookshelf version

2.2.22

How are you running audiobookshelf?

Docker

@Demian98 Demian98 added the bug Something isn't working label Jun 5, 2023
@advplyr advplyr changed the title [Bug]: Missing line breaks in comment fetched from audible [Enhancement] Support HTML/rich text descriptions for audiobooks Jun 5, 2023
@advplyr advplyr added enhancement New feature or request and removed bug Something isn't working labels Jun 5, 2023
@advplyr
Copy link
Owner

advplyr commented Jun 5, 2023

Related #617

This is because Audible is giving us an HTML description where we only support plain text descriptions right now. When we strip the HTML it removes the formatting.

@undaunt
Copy link

undaunt commented Jun 28, 2023

I would just mention this would also be great for Podcast descriptions. I'm not sure if the description field for audiobooks and podcasts is the same underlying code. A few of my podcasts use things such as <p> flags in their description. See: "Haunted City - A Blades in the Dark Campaign"

<p>A city bathed in perpetual darkness, and a history not yet written. On the streets of Doskvol, it's kill or be killed as crews vie for power by any means necessary. Haunted City is a dark, twisted romp through a Victorian dystopia, using the rules of arguably the greatest RPG system of the modern era — Blades in the Dark.</p><br /><p>Watch new episodes of Haunted City Wednesdays at 8PM ET on <a href="http://www.twitch.tv/theglasscannon" target="_blank">twitch.tv/theglasscannon</a>. YouTube videos and podcasts drop on Friday. Patreon subscribers can enjoy an ad-free version of the podcast at <a href="http://www.patreon.com/glasscannon" target="_blank">patreon.com/glasscannon</a>.</p><br /><p>Haunted City is an original adventure using the Blades in the Dark game system by Evil Hat Productions.</p><br /><p> Hosted on Acast. See <a target="_blank" href="https://acast.com/privacy">acast.com/privacy</a> for more information.</p>

Or, if not easily supportable, is there a way to strip HTML from podcast feed descriptions?

Thanks! This app is amazing!

@ZLoth
Copy link

ZLoth commented Apr 2, 2024

Somehow, my request to "Associate hyperlinks with an audiobook" got redirected here. What I was hoping to add to some of my books are....

Admittedly, the book's website reference and third party references would apply to non-fiction books such as Great Courses or Modern Scholar.

This could also be extended to author/narriator page including references to that person's own site as well as IMDB and GoodReads.

@ZLoth
Copy link

ZLoth commented Apr 6, 2024

I was previously utilizing Emby as my audiobook manager, and this is one of the features that I missed. I ended up cleaning most of the descriptions from Audible so that the output woud fit properly. (You wouldn't believe how many </b><b> and <p></p> I removed to better format the text.)

The keep thing to remember is that that you have to sanitize the output for at least three scenarios:

  • From the import of the external metadata (iTunes, Audible)
  • From the user input at the server page level
  • Output from the server to the end user (because there are some naughty characters who will modify the data at the DB level to output malicious HTML code)

As an example, here is the Audible page for NPR Road Trips: Family Vacations - https://www.audible.com/pd/NPR-Road-Trips-Family-Vacations-Audiobook/B00AQ3VPFU :
image

Here is the same description after import into Audiobookshelf:
image

From my experience, the following tags should be allowed:

  • <p> and </p>
  • <br> and <br />
  • <ul> and </ul>
  • <li> and </li>
  • <ol> and </ol>
  • <em> and </em> with it's cousin <i> and </i>
  • <strong> and </strong> with it's cousin <b> and </b>
  • <u> and </u>

I've only seen <span> used on a couple of GraphicAudio titles, and it was usually used to color the text red:
<span style="color: #d92027;">ADVISORY: Due to subject matter, this title contains realistically harsh language, including racial epithets and sexual content.</span>

While it's optional, I also converted em-dashes and en-dashes to &mdash; and &ndash; equivelents as well as the double quotes into &ldquo; and &rdquo; respectively.

@ZLoth
Copy link

ZLoth commented Oct 29, 2024

This is because Audible is giving us an HTML description where we only support plain text descriptions right now. When we strip the HTML it removes the formatting.

@advplyr , Is there any way to at least support paragraph breaks now to avoid the "blob of text" until full formatting is supported in ABS?

@vangorra
Copy link

If plain text support is preferred, then I propose the metadata provider convert the html description to markdown.
From there, the clients can show content as is (enclosed in

 equivalent for html). If we want to get really fancy, the clients can convert the markdown to whatever format they want.

This approach avoids the risk of html injection and keeps the description standardized.

Thoughts?

@advplyr advplyr added the awaiting release Issue is resolved and will be in the next release label Jan 25, 2025
@ZLoth
Copy link

ZLoth commented Jan 25, 2025

Thank you @advplyr . Looking forward to release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting release Issue is resolved and will be in the next release enhancement New feature or request
Projects
None yet
5 participants