diff --git a/packages/content-handler/src/websites/stack-overflow-handler.ts b/packages/content-handler/src/websites/stack-overflow-handler.ts index 384922e88..21960dc33 100644 --- a/packages/content-handler/src/websites/stack-overflow-handler.ts +++ b/packages/content-handler/src/websites/stack-overflow-handler.ts @@ -10,10 +10,14 @@ export class StackOverflowHandler extends ContentHandler { const newText = element.ownerDocument.createElement('div') const text = element.querySelector(`div[itemprop='text']`) if (text) { - const votes = element.querySelector(`div[itemprop='upvoteCount']`) + const votes = element + .querySelector(`div[itemprop='upvoteCount']`) + ?.getAttribute('data-value') if (votes) { - newText.innerHTML = `

${title}:${votes.innerHTML}vote(s)

${text.innerHTML}
` + newText.innerHTML = `

${title}: ${votes} vote${ + votes === '1' ? '' : 's' + }

${text.innerHTML}` } } return newText @@ -89,7 +93,7 @@ export class StackOverflowHandler extends ContentHandler { const mainEntity = dom.querySelector(`div[itemprop='mainEntity']`) if (mainEntity) { const newMainEntity = dom.createElement('div') - const question = mainEntity.querySelector('.question') + const question = mainEntity.querySelector('#question') if (question) { newMainEntity.appendChild(this.parseText(question, 'Question')) newMainEntity.appendChild(this.parseAuthors(question))