MCPcopy Create free account
hub / github.com/NanoNets/docstrange / extract_url

Method extract_url

docstrange/extractor.py:233–260  ·  view source on GitHub ↗

Convert a URL to internal format. Args: url: URL to extract Returns: ConversionResult containing the processed content Raises: ConversionError: If conversion fails

(self, url: str)

Source from the content-addressed store, hash-verified

231 return self.extract(file_path)
232
233 def extract_url(self, url: str) -> ConversionResult:
234 """Convert a URL to internal format.
235
236 Args:
237 url: URL to extract
238
239 Returns:
240 ConversionResult containing the processed content
241
242 Raises:
243 ConversionError: If conversion fails
244 """
245 # Cloud mode doesn't support URL conversion
246 if self.cloud_mode:
247 raise ConversionError("URL conversion is not supported in cloud mode. Use local mode for URL processing.")
248
249 # Find the URL processor
250 url_processor = None
251 for processor in self.processors:
252 if isinstance(processor, URLProcessor):
253 url_processor = processor
254 break
255
256 if not url_processor:
257 raise ConversionError("URL processor not available")
258
259 logger.info(f"Converting URL: {url}")
260 return url_processor.process(url)
261
262 def extract_text(self, text: str) -> ConversionResult:
263 """Convert plain text to internal format.

Callers 1

process_single_inputFunction · 0.80

Calls 2

ConversionErrorClass · 0.85
processMethod · 0.45

Tested by

no test coverage detected