You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I need to search for hashtags on Instagram. At first, I tried using the Public API, but it seems not working (the same problem as described here). Then I switched to using the private API endpoint (/tags/search/). But every time I get a successful response from Instagram (logs checking), the validation error pops up (and my API returns 400/500 as a result):
{
"detail": "1 validation error for Hashtag\nid\n Input should be a valid string [type=string_type, input_value=17843993695028891, input_type=int]\n For further information visit https://errors.pydantic.dev/2.5/v/string_type"
}
I checked the Hashtag model and its id property has str type, while getting the int type (e.g. 17843993695028891):
Traceback (most recent call last):
File "/Users/user_bot/Apps/test-python/routers/hashtags.py", line 29, in get_hashtags
hashtags = cl.search_hashtags(query)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_bot/Apps/test-python/.venv/lib/python3.12/site-packages/instagrapi/mixins/fbsearch.py", line 67, in search_hashtags
return [extract_hashtag_v1(ht) for ht in result["results"]]
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user_bot/Apps/test-python/.venv/lib/python3.12/site-packages/instagrapi/extractors.py", line 369, in extract_hashtag_v1
return Hashtag(**data)
^^^^^^^^^^^^^^^
File "/Users/user_bot/Apps/test-python/.venv/lib/python3.12/site-packages/pydantic/main.py", line 164, in __init__
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Hashtag
id
Input should be a valid string [type=string_type, input_value=17841564091087227, input_type=int]
For further information visit https://errors.pydantic.dev/2.5/v/string_type
Expected behavior
To not throw any exceptions and return a list of hashtags
Desktop (please complete the following information):
OS: macOS Big Sur
Python version [e.g. 3.8.3] 3.12
instagrapi version [e.g. 1.9.3, not "latest"] 2.0.1
The text was updated successfully, but these errors were encountered:
Describe the bug
I need to search for hashtags on Instagram. At first, I tried using the Public API, but it seems not working (the same problem as described here). Then I switched to using the private API endpoint (
/tags/search/
). But every time I get a successful response from Instagram (logs checking), the validation error pops up (and my API returns 400/500 as a result):I checked the Hashtag model and its
id
property hasstr
type, while getting the int type (e.g. 17843993695028891):So I updated the type from
str
tostr | int
and it started working without any exceptions:I thought you guys might have a look at this and change/update or give some kind of answer/clarification to this.
To Reproduce
I have an endpoint to search for hashtags, something like this:
Traceback
Expected behavior
To not throw any exceptions and return a list of hashtags
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: