Here's a "rainwater colander", an inline downspout rainwater diverter, a product I first stumbled across at my Home Depot while looking for a downspout extender to better direct rainwater into my garden. It snaps in to your existing gutter downspout (provided you use one that is sized for your downspout). It's "designed to filter out debris in rainwater collection barrels and systems" including surge tanks and "can connect to a garden hose to water plants directly".
I happen to have Amerimax 2" square section downspouts (the previous owner installed them), which is why I went searching for this brand, but this particular design won't work for me since it's made for a 2" x 3" rectangular cross section downspout. A 3" x 4" variant is also available, but not one in 2"x 2".
My casual observation is that square section downspouts seem to have fallen into disfavor so the selection of parts is limited.
A helpful pdf has more information about the Amerimax Rainwater Colander product.
The CATCH-A-Raindrop™ Rainwater Colander™ connects to a vertical downspout and captures 50%
of rainwater while debris is directed down the gutter, diverting filtered rainwater into a storage tank or
rain barrel, or directly to a garden.
As the water travels down the inside walls of the downspout, the rainwater adheres to the walls of
the downspout and does not free-fall from the center. The Rainwater Colander™ installed inside the
downspout captures water free of large debris in a 2-inch tall reservoir that has an outlet to attach to
a garden hose or cap when not in use. The innovative design of the patented colander automatically
diverts rainwater back into the downspout when the rain barrel is full or a cap is attached.
this additive manufacturing design.