def indir(): try: loader = Instaloader() loader.download_profile(subject.get(), profile_pic_only=True) except: messagebox.showerror( "Error!", "Bu kullanıcı zaten kaydedilmiş olabilir veya düzgün bir kullanıcı adı giriniz" )
def show_image(self, obj): instaloader = Instaloader() username = self.user.text instaloader.download_profile(username, profile_pic_only=True) filename = glob(str(username + "/*jpg")) img_data = str(filename[0]) image = Image(source=img_data, pos_hint={ "center_x": 0.5, "center_y": 0.3 }, size_hint=(0.5, 1)) image.remove_widget(image) self.screen.add_widget(image)
""" import os from instaloader import Instaloader # The input file contains ids of users to collect data from # one instagram id per line input_file = os.path.join('data', 'raw', '2019-03-31_instagram-ids.txt') with open(input_file, 'r') as f: ids_list = f.read() ids_list = ids_list.split('\n') L = Instaloader(dirname_pattern=os.path.join('data', 'raw', '{profile}'), filename_pattern="{shortcode}", download_pictures=True, download_videos=False, download_video_thumbnails=False, download_geotags=False, download_comments=True, save_metadata=False, compress_json=False, post_metadata_txt_pattern= "{profile},{date_utc},{shortcode},{likes},{comments}") for username in ids_list: print("Downloading data for :", username) L.download_profile(username)
USERNAME = "" FIELD_SEPARATOR = "xxFLDxx" META_DATA = ("{shortcode}" + FIELD_SEPARATOR + "{date_utc}" + FIELD_SEPARATOR + "{profile}" + FIELD_SEPARATOR + "{caption}") insta_data_file = Path("data", "processed", "insta-ids.csv") insta_data = (pd.read_csv(insta_data_file, header=None, names=['insta_id'])) L = Instaloader(dirname_pattern=os.path.join('data', 'raw', '{profile}'), filename_pattern="{shortcode}", download_pictures=False, download_videos=False, download_video_thumbnails=False, download_geotags=False, download_comments=False, save_metadata=False, compress_json=False, post_metadata_txt_pattern=META_DATA) L.load_session_from_file(USERNAME) insta_ids = insta_data.insta_id.unique() for insta_id in tqdm(insta_ids): try: L.download_profile(insta_id) except Exception: continue