I have a code to check out whether that instagram account exist or not
exist=[]
url = []
for i in cli:
r = requests.get("https://www.instagram.com/" i "/")
if r.apparent_encoding == 'Windows-1252':
exist.append(i)
url.append("instagram.com/" i "/")
exist
['duolingoenglishtest',
'duolingo',
'duolingoespanol',
'duolingofrance']
I want to do a screenshot for each instagram account, and I think have found a way to screenshot each instagram account, but I don't know how to change the screenshots name for each image.
for ss in exist:
driver.get("https://www.instagram.com/" ss "/")
time.sleep(5)
screenshot = driver.save_screenshot('Pictures/Insta2.png')
driver.quit()
I really appreciate the help, Thanks!
CodePudding user response:
You could use your exist entries as filenames:
screenshot = driver.save_screenshot('Pictures/' ss '.png')
Or setup a numbering scheme:
i = 1
for ss in exist:
driver.get("https://www.instagram.com/" ss "/")
time.sleep(5)
screenshot = driver.save_screenshot('Pictures/Insta' str(i) '.png')
i = 1
driver.quit()