I am working on a python script to automate downloading images from various web sources, be it direct html parsing, or via REST or other APIs using JSON, I already had some functioning code, but I am starting again, this is the new script with what I have right now, with a comment describing my intent:

```python
import os
import requests
from urllib.parse import quote, urlparse

\"""
The goal is to create a generalized dataset downloader class that
can be extended for specific website/API parsing, but the heavy lifting
of downloading the pages/files and saving to disk is handled within the base
class, such that all the extended classes need to focus on is the specific url
structure, parsing the page information, and building the image captions.
\"""

class DatasetDownloader:
    def __init__(self, base_url : str, output_folder : str, username=None, password=None, connection_rate=2):
        self.base_url = base_url
        self.output_folder = output_folder

        if not os.path.exists(self.output_folder):
            os.makedirs(self.output_folder)

        self.username = username
        self.password = password
        self.connection_rate = connection_rate # TODO: Implement this
    
    def make_request(self, url):
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'
        }

        if self.username and self.password:
            response = requests.get(url, headers=headers, auth=(self.username, self.password))
        else:
            response = requests.get(url, headers=headers)

        response.raise_for_status()  # Raise an exception for bad responses
        return response
    
    def download_resource(self, url):
        response = self.make_request(url)
        if response.status_code == 200:
            return response
        else:
            response.raise_for_status()  # Raise an exception for bad responses
```

What I want is to create a generic interface in the base class, DatasetDownloader, that I can extend in derived classes, the derived classes need:
- To be able to build appropriate urls, with a search string, either a template passed back to the base class functionality, or directly implemented in the derived classes(A url template might be better)
- Parse the received html/json from the search query(the intent was that would be returned by download_resource() )
- Gather a list of images to download, with each image having a caption, also built by the derived class(usually built from parsed html/json)

The base class then downloads the images to a subfolder inside the output folder, and for each image, a caption file with the same base filename as the image is saved as a .txt file, containing the derived classes built caption for that image, the implementation details for any one website is not the focus right now, the focus is to build flexible base class interface that can be inherited, such that it doesn't matter what inherited class is being used, it will share the same basic usage interface.
I want you to create a completed version of the DatasetDownloader base class with all the interface requirements laid out above, be sure to think things through in a step-by-step way to ensure the code follows code standards, is efficient and is correct, with no logical errors. Feel free to self-critique and double check the code for errors before showing me the full class.