subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

Request for loading every next time new posts from hashtag #79

Closed mikebgrep closed 3 years ago

mikebgrep commented 3 years ago

It will be great to load every next query in post when you load from hashtag.

adw0rd commented 3 years ago

Mike Hadz, [05.01.21 12:22] Hello I have a request how to use hashtag_medias_recent() to query every time new results to skip allready liked posts I can do it to append hashtag id to a list and after this if hashtag id in list to skip but the point is every time to query new result.Its have that kind of argument

Mike Hadz, [05.01.21 14:04] Is hashtag_media_recent return anytime same result if I run it second time will skip the previouse results Thanks

Mikhail Andreev, [06.01.21 17:17] I can provide pagination interface with next_max_id. Is that okay? You yourself will decide whether to load a new page with posts or not. And create issue

Mike Hadz, [06.01.21 18:52] Yes that is ok I will create a issue

mikebgrep commented 3 years ago

Any news about the improvement.

adw0rd commented 3 years ago

@mikebgrep I will try today

mikebgrep commented 3 years ago

@adw0rd whats happening it will have a solution.

mikebgrep commented 3 years ago

I suppose is not have working solution so to close the issue

adw0rd commented 3 years ago

@mikebgrep use hashtag_medias_a1_chunk or hashtag_medias_v1_chunk for pagination https://adw0rd.github.io/instagrapi/usage-guide/hashtag.html

>>> cl = Client()
>>> cl.login(username, password)
>>> medias, cursor = cl.hashtag_medias_v1_chunk('test', max_amount=32, tab_key='recent')
>>> len(medias)
32
>>> cursor
QVFDR0dzT3FJT0V4amFjMaQ3czlGVzRKV3FNWDJqaE1mWmltWU5VWGYtbnV6RVpoOUlsR3dCN05RRmpLc2R5SVlCQTNaekV5bUVOV0F4Vno1MDkxN1Nndg==

# NEXT cursor:

>>> medias, cursor = cl.hashtag_medias_v1_chunk('test', max_amount=32, tab_key='recent', max_id=cursor)
>>> len(medias)
32
>>> cursor
QVFEUXpfM0RtaDdmMExPQ0k0UWRlaHFJa2RVdVlaX01LTzhkNF9Dd1N2UlhtVy1vSTZvMERfYW5XN205OTBRNFBCSVJ2ZTVfTG5ZMXVmY0VJbUM5TU9URQ==
MohammadHosein21 commented 1 year ago

@mikebgrep use hashtag_medias_a1_chunk or hashtag_medias_v1_chunk for pagination https://adw0rd.github.io/instagrapi/usage-guide/hashtag.html

>>> cl = Client()
>>> cl.login(username, password)
>>> medias, cursor = cl.hashtag_medias_v1_chunk('test', max_amount=32, tab_key='recent')
>>> len(medias)
32
>>> cursor
QVFDR0dzT3FJT0V4amFjMaQ3czlGVzRKV3FNWDJqaE1mWmltWU5VWGYtbnV6RVpoOUlsR3dCN05RRmpLc2R5SVlCQTNaekV5bUVOV0F4Vno1MDkxN1Nndg==

# NEXT cursor:

>>> medias, cursor = cl.hashtag_medias_v1_chunk('test', max_amount=32, tab_key='recent', max_id=cursor)
>>> len(medias)
32
>>> cursor
QVFEUXpfM0RtaDdmMExPQ0k0UWRlaHFJa2RVdVlaX01LTzhkNF9Dd1N2UlhtVy1vSTZvMERfYW5XN205OTBRNFBCSVJ2ZTVfTG5ZMXVmY0VJbUM5TU9URQ==

I used this method but it returns None for cursor, thank you for your guidance me on this matter.