class_docstr: LinkContentFetcher is a component for fetching and extracting content from URLs. It supports handling various
  content types, retries on failures, and automatic user-agent rotation for failed web requests.
class_docstr_tok: ["LinkContentFetcher","is","a","component","for","fetching","and","extracting","content","from","URLs",".","It","supports","handling","various","content","types",",","retries","on","failures",",","and","automatic","user-agent","rotation","for","failed","web","requests","."]
docstr: Fetches content from a URL and returns it as a ByteStream.
  
  :param url: The URL to fetch content from.
  :return: A tuple containing the ByteStream metadata dict and the corresponding ByteStream.
       ByteStream metadata contains the URL and the content type of the fetched content.
       The content type is a string indicating the type of content fetched (for example, "text/html", "application/pdf").
       The ByteStream object contains the fetched content as binary data.
  
  :raises: If an error occurs during content retrieval and `raise_on_failure` is set to True, this method will
  raise an exception. Otherwise, all fetching errors are logged, and an empty ByteStream is returned.
docstr_tok: ["Fetches","content","from","a","URL","and","returns","it","as","a","ByteStream",".",":","param","url",":","The","URL","to","fetch","content","from",".",":","return",":","A","tuple","containing","the","ByteStream","metadata","dict","and","the","corresponding","ByteStream",".","ByteStream","metadata","contains","the","URL","and","the","content","type","of","the","fetched","content",".","The","content","type","is","a","string","indicating","the","type","of","content","fetched","(","for","example",",","``","text\/html","''",",","``","application\/pdf","''",")",".","The","ByteStream","object","contains","the","fetched","content","as","binary","data",".",":","raises",":","If","an","error","occurs","during","content","retrieval","and","`","raise_on_failure","`","is","set","to","True",",","this","method","will","raise","an","exception",".","Otherwise",",","all","fetching","errors","are","logged",",","and","an","empty","ByteStream","is","returned","."]
code: def fetch(self, url: str) -> Tuple[Dict[str, str], ByteStream]:
      """
      Fetches content from a URL and returns it as a ByteStream.
  
      :param url: The URL to fetch content from.
      :return: A tuple containing the ByteStream metadata dict and the corresponding ByteStream.
           ByteStream metadata contains the URL and the content type of the fetched content.
           The content type is a string indicating the type of content fetched (for example, "text/html", "application/pdf").
           The ByteStream object contains the fetched content as binary data.
  
      :raises: If an error occurs during content retrieval and `raise_on_failure` is set to True, this method will
      raise an exception. Otherwise, all fetching errors are logged, and an empty ByteStream is returned.
  
      """
      content_type: str = "text/html"
      stream: ByteStream = ByteStream(data=b"")
      try:
          response = self._get_response(url)
          content_type = self._get_content_type(response)
          handler: Callable = self.handlers[content_type]
          stream = handler(response)
      except Exception as e:
          if self.raise_on_failure:
              raise e
          # less verbose log as this is expected to happen often (requests failing, blocked, etc.)
          logger.debug(
              "Couldn't retrieve content from %s because %s",
              url,
              str(e),
          )
  
      finally:
          self.current_user_agent_idx = 0
  
      return {"content_type": content_type, "url": url}, stream
  
file_path: haystack/haystack/components/fetchers/link_content.py
imports: import logging
  from collections import defaultdict
  from concurrent.futures import ThreadPoolExecutor
  from typing import Callable, Dict, List, Optional, Tuple
  import requests
  from requests import Response
  from requests.exceptions import HTTPError
  from tenacity import RetryCallState, retry, retry_if_exception_type, stop_after_attempt, wait_exponential
  from haystack import component
  from haystack.dataclasses import ByteStream
  from haystack.version import __version__
label_desc: Use image node_id 3 for calling the LinkContentFetcher obj's underlying member method code with example usage: obj.fetch(url) and returns: dict,  stream