aledrissi

Python Code

Mar 30th, 2022 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. import os
  2. try:
  3. from requests import get
  4. except ImportError:
  5. os.system('pip install requests')
  6. from requests import get
  7. session = input('Enter SessionID : ')
  8. link = input("Enter Link Story : ")
  9. def storyViews():
  10. splt = link.split('/')
  11. idStory = splt[5]
  12. idStory = idStory.split('?')[0]
  13. Headers = {
  14. "X-IG-Capabilities": "3yo=",
  15. "Cookie": f"sessionid={session}",
  16. "Connection": "keep-alive",
  17. "Accept": "*/*",
  18. "User-Agent": "Instagram 10.4.0 (iPhone7,2; iOS 12_5_1; en_SA@calendar=gregorian; ar-SA; scale=2.00; gamut=normal; 750x1334) AppleWebKit/420+",
  19. "Accept-Language": "ar-SA;q=1",
  20. "Accept-Encoding": "gzip, deflate",
  21. "X-IG-Connection-Type": "WiFi",
  22. }
  23. req = get(f"https://i.instagram.com/api/v1/media/{idStory}/list_reel_media_viewer/",headers=Headers)
  24. total = req.json()['updated_media']['viewer_count']
  25. i = 0
  26. while i < 21:
  27. try:
  28.  
  29. print(req.json()['users'][i]['username'])
  30. i+=1
  31. except:
  32. break
  33. max = 20
  34. ii = 0
  35. req2 = get(f"https://i.instagram.com/api/v1/media/{idStory}/list_reel_media_viewer/?max_id={str(max)}",headers=Headers)
  36. while int(total) > max:
  37. try:
  38.  
  39. print(req2.json()['users'][ii]['username'])
  40. ii+=1
  41. max +=1
  42. if ii == 50:
  43. ii = 0
  44. req2 = get(f"https://i.instagram.com/api/v1/media/{idStory}/list_reel_media_viewer/?max_id={str(max)}",
  45. headers=Headers)
  46. continue
  47. except:
  48. break
  49. print(f"Finished : {total}")
  50. storyViews()
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
Add Comment
Please, Sign In to add comment