tombulled / innertube

Python Client for Google's Private InnerTube API. Works with YouTube, YouTube Music and more!
https://pypi.org/project/innertube/
MIT License
298 stars 20 forks source link

Requests cause AttributeError #18

Closed Martmists-GH closed 2 years ago

Martmists-GH commented 2 years ago

error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/innertube/clients.py", line 87, in player
    return self(
  File "/usr/lib/python3.10/site-packages/innertube/clients.py", line 56, in __call__
    response: requests.Response = self.session.post(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 577, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.10/site-packages/innertube/sessions.py", line 89, in send
    response: requests.Response = super().send(request, **kwargs)
  File "/usr/lib/python3.10/site-packages/innertube/sessions.py", line 48, in send
    if content_type.subtype != mediatype.MediaTypeSubtype.JSON:
AttributeError: 'dict' object has no attribute 'subtype'

code:

>>> import innertube as it
>>> client = it.InnerTube(it.Client.ANDROID_MUSIC)
>>> client.player(video_id="ccIdf7kcH7g")
# Error
tombulled commented 2 years ago

Thank you for raising this issue, I've been able to reproduce this and will work on a PR today :slightly_smiling_face:

tombulled commented 2 years ago

This bug appears to have been caused by an outdated version for the mediatype dependency. I created #19 to resolve this issue and will get a patched release published today

tombulled commented 2 years ago

innertube 1.0.13 published :rocket:

Once again, thanks for raising this issue. Please let me know if you encounter any further issues :100: