#import vts
#vts.download(vts.get_board())

from instagrapi import Client
import json, os
import time

with open('./config.json') as json_file:
    json_data = json.load(json_file)
    
    ROOT = json_data['ROOT']
    INSTAGRAM_AUTH = [json_data['INSTAGRAM_ID'], json_data['INSTAGRAM_PASSWORD'], json_data['INSTAGRAM_TOTP']]


cl = Client()
code = cl.totp_generate_code(INSTAGRAM_AUTH[2])
cl.login(INSTAGRAM_AUTH[0], INSTAGRAM_AUTH[1], verification_code=code)
cl.set_timzone_offset(9 * 60 * 60)
cl.set_user_agent('Instagram 361.0.0.46.88 Android (35/15; 394dpi; 1084x2412; Nothing; A065; Pong; qcom; ko_KR_#u-fw-sun-mu-celsius; 674675147)')
cl.get_settings()

json.dump(
    cl.get_settings(),
    open(f'{ROOT}temp/cookies.json', 'w')
)

print("🍪 | Account information was successfully retrieved.")
print(f"📅 | Job ended at {time.time()}")