mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
23 lines
673 B
TypeScript
23 lines
673 B
TypeScript
import { DOMWindow } from 'jsdom'
|
|
|
|
export class GolangHandler {
|
|
name = 'golangweekly'
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
shouldPrehandle = (url: URL, _dom: DOMWindow): boolean => {
|
|
const host = this.name + '.com'
|
|
// check if url ends with golangweekly.com
|
|
return url.hostname.endsWith(host)
|
|
}
|
|
|
|
prehandle = (url: URL, dom: DOMWindow): Promise<DOMWindow> => {
|
|
const body = dom.document.querySelector('body')
|
|
|
|
// this removes the "Subscribe" button
|
|
body?.querySelector('.el-splitbar')?.remove()
|
|
// this removes the title
|
|
body?.querySelector('.el-masthead')?.remove()
|
|
|
|
return Promise.resolve(dom)
|
|
}
|
|
}
|