(self)
| 143 | self.result.append(text + ' ') |
| 144 | |
| 145 | def get_markdown(self) -> str: |
| 146 | text = ''.join(self.result) |
| 147 | # Clean up excessive whitespace |
| 148 | text = re.sub(r'\n{3,}', '\n\n', text) |
| 149 | text = re.sub(r' +', ' ', text) |
| 150 | text = re.sub(r'\n +', '\n', text) |
| 151 | text = re.sub(r'\[\s*\]', '', text) # Remove empty links |
| 152 | return text.strip() |
| 153 | |
| 154 | |
| 155 | def fetch_with_requests(url: str, timeout: int = 30) -> str: |