Merge pull request #2036 from omnivore-app/fix/remove-footnote-links

Remove footnote links in wikipedia articles
This commit is contained in:
Jackson Harper 2023-04-13 12:26:49 +08:00 committed by GitHub
commit 7444d32944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,10 @@ export class WikipediaHandler extends ContentHandler {
async preParse(url: string, dom: Document): Promise<Document> {
// This removes the [edit] anchors from wikipedia pages
dom.querySelectorAll('.mw-editsection').forEach((e) => e.remove())
// Remove footnotes
dom.querySelectorAll('sup[class="reference"]').forEach((e) => e.remove())
// this removes the sidebar
dom.querySelector('.infobox')?.remove()
return Promise.resolve(dom)