Skip to content

Commit

Permalink
patch for #205
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Apr 14, 2023
1 parent a04bc46 commit edef4e2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/content-script/site-adapters/youtube/index.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { cropText } from '../../../utils'
import { config } from '../index.mjs'

function replaceHtmlEntities(htmlString) { // This function was written by ChatGPT and modified by me (iamsirsammy)
const doc = new DOMParser().parseFromString(htmlString.replace("&", "&"), 'text/html');
return doc.documentElement.innerText;
function replaceHtmlEntities(htmlString) {
// This function was written by ChatGPT and modified by me (iamsirsammy)
const doc = new DOMParser().parseFromString(htmlString.replaceAll('&', '&'), 'text/html')
return doc.documentElement.innerText
}

export default {
Expand Down Expand Up @@ -46,7 +47,7 @@ export default {
let subtitleContent = ''
while (subtitleData.indexOf('">') !== -1) {
subtitleData = subtitleData.substring(subtitleData.indexOf('">') + 2)
subtitleContent += subtitleData.substring(0, subtitleData.indexOf('<')) + ' '
subtitleContent += subtitleData.substring(0, subtitleData.indexOf('<')) + ','
}

subtitleContent = replaceHtmlEntities(subtitleContent)
Expand Down

0 comments on commit edef4e2

Please sign in to comment.