Skip to content

Update dppage.py #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions InstadpShower/dppage.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
from bs4 import BeautifulSoup
import requests
from bs4 import BeautifulSoup
import webbrowser as wb


username = input("Enter the instagram user-id: ")

username = input("Enter the username ")
try:
a = requests.get("https://www.instagram.com/"+username)
co = a.content
soup = BeautifulSoup(co,'html.parser')
link = soup.find_all('meta' , property="og:image")
print(link)
print(type(soup))

imagelink=(str(link[0])[15:])
imagelink=imagelink[:len(imagelink)-23]
print(imagelink)
wb.open_new_tab(imagelink)
result = requests.get("https://www.instagram.com/" + username)
src = result.content
soup = BeautifulSoup(src, 'lxml')
imglink = soup.find_all('meta', property='og:image')
desc = soup.find_all('meta', property='og:description')

except :
print("No such username exists")
imglink = (str(imglink[0])[15:])
imglink = imglink[:len(imglink) - 23]
imglink = imglink.replace("&lt;", "<")
imglink = imglink.replace("&gt;", ">")
imglink = imglink.replace("&amp;", "&")

desc = (str(desc[0])[15:])
desc = desc.replace('" property="og:description"/>', '')
desc = desc.replace('- See Instagram photos and videos from ', '\n')
print(desc)

ip = input("Do you want to view profile picture? y/n ")
if ip == "y" or ip == "Y":
wb.open_new_tab(imglink)
elif ip == "n" or ip == "N":
wb.open_new_tab("rb.gy/7dt4n7")
except:
print("Invalid username!")