Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python instagram downloader

#python script to download instagram image

from bs4 import BeautifulSoup
import requests
from selenium import webdriver
import time

''' ask user to input the instagram post url '''
link = input("Enter Instagram Image URL: ")

''' 
create a webdriver chrome object by passing the path of "chromedriver.exe" file.(do not include .exe in the path).
'''
driver = webdriver.Chrome('chromedriver')

''' Open the instagram post on your chrome browser'''
driver.get(link)

''' Fetch the source file of the html page using BeautifulSoup'''
soup = BeautifulSoup(driver.page_source, 'lxml')

''' Extract the url of the image from the source code''' 
img = soup.find('img', class_='FFVAD')
img_url = img['src']


'''Download the image via the url using the requests library'''
r = requests.get(img_url)

with open("instagram"+str(time.time())+".png",'wb') as f: 
    f.write(r.content)

print('success')
Comment

PREVIOUS NEXT
Code Example
Python :: python calculate angle between two points 
Python :: pandas sort by date descending 
Python :: install flask on linux mint for python3 
Python :: python divisors 
Python :: python datetime to seconds 
Python :: print only numbers from string python 
Python :: padnas drop column 
Python :: specify the number of decimals in a dataframe 
Python :: plot.barh() group by 
Python :: outliers removal pandas 
Python :: python decimal string 
Python :: python for loop even numbers 
Python :: finding the Unique values in data 
Python :: python simple input popup 
Python :: python tensorflow is not defined 
Python :: find the sum of all the multiples of 3 or 5 below 1000 python 
Python :: how to convert days into seconds in python using time.time() 
Python :: how to slice even index value from a list in python using slice function 
Python :: what is imageTk in pil python 
Python :: python check if two sets intersect 
Python :: Using Variables with Multiple Instances of a Python Class 
Python :: python Program to check if a given year is leap year 
Python :: radix sort python 
Python :: integer colomn to datetime 
Python :: Return a Series containing counts of unique values. 
Python :: create spark dataframe from pandas 
Python :: create exe from python script 
Python :: keras linear regression 
Python :: python get desktop directory 
Python :: make entry bigger in tkinter python 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =