mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-27 22:11:07 +00:00
Update dppage.py
In the first version, the dp showed was of 150*150 showed on the website. This version extracts the url of the version uploaded on Instagram. This is the best version possible of any dp.
This commit is contained in:
parent
a5705ac9ee
commit
289cfda07c
|
@ -1,24 +1,18 @@
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
import requests
|
|
||||||
import webbrowser as wb
|
import webbrowser as wb
|
||||||
|
import requests
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
username = input("Enter the instagram user-id: ")
|
username=input("Enter the username : ")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a = requests.get("https://www.instagram.com/"+username)
|
content = requests.get("https://www.instagram.com/"+username).content
|
||||||
co = a.content
|
find=re.findall(r"logging_page_id.*show_suggested_profiles",str(content))
|
||||||
soup = BeautifulSoup(co,'html.parser')
|
user_id=((find[0][16:]).split(","))[0][14:-1] # We get the user id of the username
|
||||||
link = soup.find_all('meta' , property="og:image")
|
jsonreq=requests.get("https://i.instagram.com/api/v1/users/"+user_id+"/info/").content # using a link we get the whole info of the person
|
||||||
print(link)
|
jsonloaded=json.loads(jsonreq)
|
||||||
print(type(soup))
|
imgurl=jsonloaded["user"]["hd_profile_pic_url_info"]["url"]
|
||||||
|
wb.open_new_tab(imgurl)
|
||||||
imagelink=(str(link[0])[15:])
|
except:
|
||||||
imagelink=imagelink[:len(imagelink)-23]
|
|
||||||
print(imagelink)
|
|
||||||
wb.open_new_tab(imagelink)
|
|
||||||
|
|
||||||
except :
|
|
||||||
print("No such username exists")
|
print("No such username exists")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user