def _scrapperInstaExplorer(self, page): dict_postMedia = {} values = self._getJsonData(page) try: medias = values['entry_data']['LocationsPage'][0]['graphql'][ 'location']['edge_location_to_media']['edges'] except: medias = values['entry_data']['TagPage'][0]['graphql']['hashtag'][ 'edge_hashtag_to_media']['edges'] count = len(medias) x = 0 while x < count: try: description = medias[x]['node']['edge_media_to_caption'][ 'edges'][0]['node']['text'] except: description = None ownerId = medias[x]['node']['owner']['id'] media = medias[x]['node']['display_url'] media = shortCutUrl(media) profile = self._getNameById(ownerId) username = profile[0] name = profile[1] dico = { username: { "name": name, "media": media, "id": ownerId, } } dict_postMedia.update(dico) x += 1 return (dict_postMedia)
def searchInstagram(self, instagram_info, user, text): global path instagram_info.destroy() # Progress bar widget progress = Progressbar(self, orient=HORIZONTAL, length=200, mode='determinate') progress.place(x=600, y=200) # user = input(" Username: "******"https://instagram.com/" + user try: progress['value'] = 5 self.update_idletasks() time.sleep(0.1) insta = instagramSearchTool() insta.getInfo(user) progress['value'] = 10 self.update_idletasks() time.sleep(0.1) name = insta.name userId = insta.id images = insta.profi_pic_hd try: image = shortCutUrl(images) username = insta.username progress['value'] = 15 self.update_idletasks() time.sleep(0.1) private = insta.private followers = insta.followers friend = insta.friends publication = insta.medias progress['value'] = 20 self.update_idletasks() time.sleep(0.1) bio = insta.biography url = insta.url email = insta.email adresse = insta.adresse phone = insta.phone progress['value'] = 25 self.update_idletasks() time.sleep(0.1) # Set up the image URL image_url = "{}".format(images) try: os.mkdir("{0}/{1}".format(os.getcwd(), user)) except FileExistsError: pass image_filename = wget.download(image_url) os.system("mv {0} profile.png && mv profile.png {1}/".format( image_url.split('/')[-1].split('?')[0], user)) load = Image.open("{0}/profile.png".format(user)) render = ImageTk.PhotoImage(load) img = Label(self, image=render) img.image = render img.place(x=1030, y=10) img.bind("<Button-1>", lambda e: Url.Url.callback(image_url)) progress['value'] = 30 self.update_idletasks() time.sleep(0.1) text.insert(END, "\n[{}]\n".format(username)) text.insert(END, " Name: {}\n".format(name)) text.insert(END, " Pictures: {}\n".format(image)) text.insert(END, " ID: {}\n".format(userId)) text.insert(END, " Protected: {}\n".format(private)) text.insert( END, " Subscribers: {} | Subscriptions: {}\n".format( followers, friend)) text.insert(END, " Publication: {}\n".format(publication)) text.insert(END, " Bio: {}\n".format(bio)) progress['value'] = 50 self.update_idletasks() time.sleep(0.1) if url: text.insert(END, " Url: {}\n".format(url)) if email: text.insert(END, " Email: {}\n".format(email)) if phone: text.insert(END, " Phone: {}\n".format(phone)) if adresse: text.insert(END, " Places: {}\n".format(adresse)) if not private: while True: choix = messagebox.askquestion( "Download Image", "Do you want to download the last 12 photos posted?") if choix == "" or choix.upper() == "NO": progress['value'] = 100 self.update_idletasks() time.sleep(0.1) progress.destroy() break elif choix.upper() == "YES": progress['value'] = 70 self.update_idletasks() time.sleep(0.1) pat(progress, 70, insta, urlProfil, self, user) break else: messagebox.showinfo( "Private Account", "We can't download images from {0}'s Profile.".format( user)) progress.destroy() except TypeError: progress.destroy() messagebox.showerror("NOT FOUND", user + " user not found") except requests.exceptions.ConnectionError: progress.destroy() messagebox.showerror("Connection Issue", "Maybe Your Internet Is Too Slow.")
def searchInstagram(): user = input(" Username: "******"https://instagram.com/" + user insta = instagramSearchTool() insta.getInfo(user) name = insta.name userId = insta.id images = insta.profi_pic_hd images = shortCutUrl(images) username = insta.username private = insta.private followers = insta.followers friend = insta.friends publication = insta.medias bio = insta.biography url = insta.url email = insta.email adresse = insta.adresse phone = insta.phone print("\n[%s]\n" % (username)) print(found + " Name: %s" % (name)) print(found + " Pictures: %s" % (images)) print(found + " ID: %s" % (userId)) print(found + " Protected: %s" % (private)) print(found + " Abonnés: %s | Abonnements: %s" % (followers, friend)) print(found + " Publication: %s" % (publication)) print(found + " Bio: %s" % (bio)) if url: print(found + " Url: %s" % (url)) if email: print(found + " Email: %s" % (email)) if phone: print(found + " Telephone: %s" % (phone)) if adresse: print(found + " Lieux: %s" % (adresse)) if not private: print("\n" + question + " Voulez vous télécharger les 12 dernières photos postées ?") while True: choix = input("\n [o/N]: ") if choix == "" or choix.upper() == "N": break elif choix.upper() == "O": print("\n" + question + " Ou voulez-vous enregistrer les photos ?") pathDefault = os.getcwd() print(Fore.YELLOW + " Default path: " + pathDefault + Fore.RESET) path = input("\n Path: ") print("\n" + wait + " Téléchargement des photos de '%s'\n" % (user)) if not path: path = pathDefault insta.downloadPictures(urlProfil, path) print("\n" + found + " Téléchargement fini.") break
def search_instagram(user): urlProfil = "https://instagram.com/" + user insta = instagramSearchTool() insta.getInfo(user) name = insta.name userId = insta.id images = insta.profi_pic_hd images = shortCutUrl(images) username = insta.username private = insta.private followers = insta.followers friend = insta.friends publication = insta.medias bio = insta.biography url = insta.url email = insta.email adresse = insta.adresse phone = insta.phone print("\n[%s]\n" % (username)) print(found + " Name: %s" % (name)) print(found + " Pictures: %s" % (images)) print(found + " ID: %s" % (userId)) print(found + " Protected: %s" % (private)) print(found + " Abonnés: %s | Abonnements: %s" % (followers, friend)) print(found + " Publication: %s" % (publication)) print(found + " Bio: %s" % (bio)) if url: print(found + " Url: %s" % (url)) if email: print(found + " Email: %s" % (email)) if phone: print(found + " Telephone: %s" % (phone)) if adresse: print(found + " Lieux: %s" % (adresse)) if not private: print("\n" + question + " Voulez vous télécharger les 12 dernières photos postées ?") while True: choix = input("\n [o/N]: ") if choix == "" or choix.upper() == "N": break elif choix.upper() == "O": print("\n" + question + " Ou voulez-vous enregistrer les photos ?") pathDefault = os.getcwd() print(Fore.YELLOW + " Default path: " + pathDefault + Fore.RESET) path = input("\n Path: ") print("\n" + wait + " Téléchargement des photos de '%s'\n" % (user)) if not path: path = pathDefault pictureInfo = insta.get_picturesInfo(urlProfil) for i in pictureInfo: media = pictureInfo[i]['display'] typeMedia = pictureInfo[i]['type_media'] date = pictureInfo[i]['date'] view = pictureInfo[i]['info'] loc = pictureInfo[i]['localisation'] filename = user + '_' + str(i) + ".jpg" if not loc: loc = '' insta.downloadPictures(media, path, filename) print("(%s) %s %s [%s] %s téléchargé." % (str(i), typeMedia, date, view, loc)) print("\n" + found + " Téléchargement fini.") break
def searchInstagram(): user = input(" Username: "******"https://instagram.com/"+user insta = instagramSearchTool() insta.getInfo(user) name = insta.name userId = insta.id images = insta.profi_pic_hd images = shortCutUrl(images) username = insta.username private = insta.private followers = insta.followers friend = insta.friends publication = insta.medias bio = insta.biography url = insta.url email = insta.email adresse = insta.adresse phone = insta.phone print("\n[%s]\n" % (username)) print(found+" Name: %s" % (name)) print(found+" Pictures: %s" % (images)) print(found+" ID: %s" % (userId)) print(found+" Protected: %s" % (private)) print(found+" Subscribers: %s | Subscriptions: %s" % (followers, friend)) print(found+" Publication: %s" % (publication)) print(found+" Bio: %s" % (bio)) if url: print(found+" Url: %s" % (url)) if email: print(found+" Email: %s" % (email)) if phone: print(found+" Telephone: %s" % (phone)) if adresse: print(found+" Places: %s" % (adresse)) if not private: print("\n"+question+" Do you want to download the last 12 photos posted ?") while True: choix = input("\n [o/N]: ") if choix == "" or choix.upper() == "N": break elif choix.upper() == "O": print("\n"+question+" Or do you want to save the photos ?") pathDefault = os.getcwd() print(Fore.YELLOW+" Default path: "+pathDefault+Fore.RESET) path = input("\n Path: ") print("\n"+wait+" Download photos from '%s'\n" % (user)) if not path: path = pathDefault pictureInfo = insta.get_picturesInfo(urlProfil) for i in pictureInfo: media = pictureInfo[i]['display'] typeMedia = pictureInfo[i]['type_media'] date = pictureInfo[i]['date'] view = pictureInfo[i]['info'] loc = pictureInfo[i]['localisation'] filename = user+'_'+str(i)+".jpg" if not loc: loc = '' insta.downloadPictures(media, path, filename) print("(%s) %s %s [%s] %s downloaded." % (str(i), typeMedia, date, view, loc)) print("\n"+found+" Download finished.") break