subzeroid / instagrapi

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

[BUG] #594

Closed Bestsenator closed 2 years ago

Bestsenator commented 2 years ago

Due to the new Instagram update, the highlighted part did not work, please fix it

adw0rd commented 2 years ago

@Alinush124578 show your code, traceback, examples

Bestsenator commented 2 years ago

code :

from instagrapi import Client
cl = Client()

s_id = '' #Session_id

def main():
    link = 'https://www.instagram.com/s/aGlnaGxpZ2h0OjE3OTQ0MjM4NDczODQwNDA4?story_media_id=2783500379422796645_2012240260&utm_medium=copy_link'
    cl.login_by_sessionid(s_id)
    pk = cl.highlight_pk_from_url(link)
    info = str(cl.highlight_info(pk))
    print(info)
main()

trace back :

  File "d:\python\insta bot\new_15.py", line 15, in <module>
    main()
  File "d:\python\insta bot\new_15.py", line 12, in main
    pk = cl.highlight_pk_from_url(link)
  File "C:\Users\Bestsenator\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\highlight.py", line 35, in highlight_pk_from_url
    assert '/highlights/' in url, 'URL must contain "/highlights/"'
AssertionError: URL must contain "/highlights/"

examples : https://www.instagram.com/s/aGlnaGxpZ2h0OjE3OTQ0MjM4NDczODQwNDA4?story_media_id=2783500379422796645_2012240260&utm_medium=copy_link Screenshot 2022-03-04 085646

adw0rd commented 2 years ago

@Alinush124578 you are not specifying a highlight link, but a share link! Follow your link and you will see the highlight link

The share link can contain not only a highlight, but also a post

https://github.com/adw0rd/instagrapi/blob/master/instagrapi/mixins/share.py

Bestsenator commented 2 years ago

how to use it ??

adw0rd commented 2 years ago

@Alinush124578 read the docstring!

cl.share_info_by_url(URL)

Bestsenator commented 2 years ago

tnx so much Is it possible to help me with another problem ??? I want to take the time interval between two dates as a list of dates. For example, from 22/11/17 to 22/11/30 Which I want to be a list as follows: 18/11/22, 19/11/22, 20/11/22, .......