Skip to content

Commit

Permalink
Revert "Added banner, colored output, and improved argument usage"
Browse files Browse the repository at this point in the history
  • Loading branch information
AyalX committed Jun 12, 2023
1 parent d5bc3bb commit 7108b50
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 115 deletions.
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/Instagram-Lookup.iml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This script allows you to search for an Instagram profile using user ID or retri

## Prerequisites
- Python 3.x
- Requests library (`pip install requests`)

## Session ID
In order to use this script, you need to provide your Instagram session ID. The session ID is a unique identifier associated with your Instagram login session, and it is required to authenticate your requests to the Instagram API.
Expand All @@ -21,8 +22,11 @@ To obtain your Instagram session ID, you can follow these steps:

## Usage
1. Clone the repository or download the script.
2. Install the required dependencies by running `pip install -r requirements.txt` in your terminal.
3. Run the script by executing `python3 ig-lookup.py --session [SESSION_ID] {--username [USERNAME] OR --userid [USERID]} ` in your terminal.
2. Install the required dependencies by running `pip install requests` in your terminal.
3. Run the script by executing `python ig-lookup.py` in your terminal.
4. Input your Instagram session ID.

You will be prompted to choose the search method: either by user ID or by username. Provide the required information and follow the instructions to retrieve the desired Instagram profile username or user ID.

Please note that the session ID will eventually expire.

Expand Down
63 changes: 12 additions & 51 deletions ig-lookup.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
import requests
from pyfiglet import Figlet
from termcolor import colored
from argparse import ArgumentParser, Namespace


def print_hi(header):
f = Figlet(font="standard", width=180)
welcome = colored(f.renderText(text=header), "yellow")
if readargs().verbose is not False:
print(f"\n{welcome}")
pass


def printincolor(word, color='white'):
print(colored(word, color))
pass


def readargs() -> Namespace:
parser = ArgumentParser()
parser.add_argument("-s", "--session", dest="session", help="your own session, you will find it in inspect element", required=True)
parser.add_argument("-u", "--username", dest="username", help="Enter the username to lookup", required=False)
parser.add_argument("-i", "--userid", dest="userID", help="Enter the userID to lookup", required=False)
parser.add_argument("-q", "--quiet", action="store_false", dest="verbose", default=True, help="don't print status messages to stdout", required=False)
arguments = parser.parse_args()
# ArgumentParser
return arguments
pass


def find_instagram_profile(user_id, session_id):
url = f"https://i.instagram.com/api/v1/users/{user_id}/info/"
Expand All @@ -43,7 +14,6 @@ def find_instagram_profile(user_id, session_id):
else:
return "Unable to retrieve profile."


def find_instagram_id_by_username(username):
url = f"https://www.instagram.com/{username}/"
response = requests.get(url)
Expand All @@ -55,29 +25,20 @@ def find_instagram_id_by_username(username):
else:
return None


def main():
# session_id = input("Enter your Instagram session ID: ")
print_hi("Instagram-lookup")
args = readargs()
# choice = input("[*] Enter '1' to search by user ID, or '2' to search by username: ")
if args.userID is not None:
# user_id = input("[*] Enter the user ID to search for: ")
profile_url = find_instagram_profile(args.userID, args.session)
printincolor(f"[+] userID {args.userID} refers to: {profile_url}", "blue")
elif args.username is not None:
# username = input("[*] Enter the username to search for: ")
user_id = find_instagram_id_by_username(args.username)
session_id = input("Enter your Instagram session ID: ")
choice = input("Enter '1' to search by user ID, or '2' to search by username: ")
if choice == '1':
user_id = input("Enter the user ID to search for: ")
profile_url = find_instagram_profile(user_id, session_id)
print(profile_url)
elif choice == '2':
username = input("Enter the username to search for: ")
user_id = find_instagram_id_by_username(username)
if user_id:
printincolor(f"[+] User ID for {args.username}: {user_id}", "green")
print(f"User ID for {username}: {user_id}")
else:
printincolor("[-] Unable to retrieve user ID.", "red")
else:
printincolor("[-] username or userID one should be in use", "red")

printincolor("[*] DONE\n", "blue")


print("Unable to retrieve user ID.")

if __name__ == "__main__":
main()
printincolor("AyalX", "yellow")
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

0 comments on commit 7108b50

Please sign in to comment.