Skip to content
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
36 changes: 22 additions & 14 deletions hostagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
import pycountry
import json
import requests
import base64
from datetime import datetime
from urllib.parse import quote_plus
from json import dumps, decoder
import phonenumbers
from phonenumbers.phonenumberutil import region_code_for_country_code




v = "v1.2"
v = "v1.2.1"
q = "https://github.com/banaxou/"
white = "\033[97m"
red = "\033[91m"
Expand Down Expand Up @@ -128,16 +127,17 @@ def lookup(username):
def user_info():
ig = instaloader.Instaloader()
w = 50
red = "\033[1;31m"
r = "\033[0m"
b = "\033[1;34m"

session_file = "sessionid.txt"
session_id = ""
if os.path.exists(session_file):
with open(session_file, "r") as f:
session_id = f.read().strip()

if os.path.exists(session_file):
with open(session_file, "r") as f:
encoded_data = f.read().strip()
decoded_bytes = base64.b64decode(encoded_data)
session_id = decoded_bytes.decode("utf-8")

ins = input(f"{red}>{r} Enter Instagram username: ") or "zuck"

try:
Expand Down Expand Up @@ -221,7 +221,7 @@ def user_info():
print(f"{red}Unexpected error{r}: {e}")


def id_info():
def id_info():
session_file = "sessionid.txt"
x = 50

Expand All @@ -232,9 +232,12 @@ def id_info():
session_id = ""

if not session_id:
session_id = input(f"{b}>{r} Enter your session ID: ").strip()
session_id = input(f"{b}>{r} Enter your session ID: ").strip()
te = session_id.encode("utf-8")
b6 = base64.b64encode(te)
bb = b6.decode("utf-8")
with open(session_file, "w") as f:
f.write(session_id)
f.write(bb)

idx = input(f"{red}>{r} Enter Instagram ID: ").strip() or "314216"

Expand Down Expand Up @@ -320,8 +323,11 @@ def watch_id():

if not session_id:
session_id = input(f"{b}>{r} Enter your session ID: ").strip()
te = session_id.encode("utf-8")
b6 = base64.b64encode(te)
bb = b6.decode("utf-8")
with open(session_file, "w") as f:
f.write(session_id)
f.write(bb)

idx = input(f"{red}>{r}Enter Instagram ID: ").strip() or "314216"

Expand Down Expand Up @@ -470,13 +476,15 @@ def login_easy():
ig = instaloader.Instaloader()
uzer = input(f"{red}>{r} Enter username: ").strip()
session = input(f"{red}>{r} Enter session ID: ").strip()
te = session.encode("utf-8")
b6 = base64.b64encode(te)
bb = b6.decode("utf-8")
ig.context._session.cookies.set("sessionid", session)
profile = instaloader.Profile.from_username(ig.context, uzer)
print(f" Successfully logged in as: {profile.username}")


with open("sessionid.txt", "w") as f:
f.write(session)
f.write(bb)
break
print("Invalid choice Please enter 'p' or 's'")
time.sleep(1)
Expand Down