()
| 11 | } |
| 12 | |
| 13 | private async fetchRemoteHTML() { |
| 14 | const response = await fetch(this.url.href, { |
| 15 | method: 'GET', |
| 16 | headers: { |
| 17 | 'User-Agent': |
| 18 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', |
| 19 | 'Content-Type': 'text/html' |
| 20 | } |
| 21 | }) |
| 22 | |
| 23 | if (!response.ok) { |
| 24 | throw new Error('Failed to fetch the page') |
| 25 | } |
| 26 | |
| 27 | return response.text() |
| 28 | } |
| 29 | |
| 30 | private createDocumentFromHTML(html: string) { |
| 31 | const parser = new DOMParser() |