Problem
SearchResource.list type-hints type as Optional[Union[str, list, tuple, set]] and its docstring says "The value is a comma-separated list of resource types", but the value is passed straight into the params dict without normalization. When a caller passes a list, requests serializes it as repeated query params (type=video&type=channel), while YouTube Data API v3 expects a single comma-separated type=video,channel.
Steps
pip install python-youtube==0.9.9
from pyyoutube import Client; c = Client(api_key="...")
c.search.list(q="news", type=["video", "channel"], max_results=10)
Expected
Request URL contains type=video%2Cchannel (single param, comma-joined), consistent with sibling params like parts which go through enf_parts.
Actual
Request URL contains type=video&type=channel (two params). The API silently ignores the second and applies only type=video.
File cite
pyyoutube/resources/search.py:233 — "type": type, bypasses enf_comma_separated. Compare to pyyoutube/resources/search.py:216 where parts is normalized via enf_parts. Signature declaring list/tuple/set support: pyyoutube/resources/search.py:42. Docstring: pyyoutube/resources/search.py:144-147.
Environment
python-youtube 0.9.9, requests >=2.28.0,<3.0.0, Python 3.9-3.14 per pyproject.toml.
Suggested fix
Wrap with enf_comma_separated(field="type", value=type) before insertion into params.
Thanks for maintaining sns-sdks/python-youtube!
Problem
SearchResource.listtype-hintstypeasOptional[Union[str, list, tuple, set]]and its docstring says "The value is a comma-separated list of resource types", but the value is passed straight into theparamsdict without normalization. When a caller passes a list,requestsserializes it as repeated query params (type=video&type=channel), while YouTube Data API v3 expects a single comma-separatedtype=video,channel.Steps
pip install python-youtube==0.9.9from pyyoutube import Client; c = Client(api_key="...")c.search.list(q="news", type=["video", "channel"], max_results=10)Expected
Request URL contains
type=video%2Cchannel(single param, comma-joined), consistent with sibling params likepartswhich go throughenf_parts.Actual
Request URL contains
type=video&type=channel(two params). The API silently ignores the second and applies onlytype=video.File cite
pyyoutube/resources/search.py:233—"type": type,bypassesenf_comma_separated. Compare topyyoutube/resources/search.py:216wherepartsis normalized viaenf_parts. Signature declaring list/tuple/set support:pyyoutube/resources/search.py:42. Docstring:pyyoutube/resources/search.py:144-147.Environment
python-youtube 0.9.9, requests >=2.28.0,<3.0.0, Python 3.9-3.14 per
pyproject.toml.Suggested fix
Wrap with
enf_comma_separated(field="type", value=type)before insertion intoparams.Thanks for maintaining sns-sdks/python-youtube!