#!/usr/bin/env python3
# coding: utf-8
#  ▓▓▓▓▓▓▓▓▓▓ 
# ░▓ Author ▓ Abdullah <https://abdullah.today/> 
# ░▓▓▓▓▓▓▓▓▓▓ 
# ░░░░░░░░░░ 


import subprocess
import requests
from bs4 import BeautifulSoup


# Getting values

get_url_1, get_url_2 = subprocess.run(['gpg', '-dq',
    '/home/ak/.local/share/misc/url-1.gpg'], check=True, stdout=subprocess.PIPE,
    stderr=subprocess.PIPE, encoding='utf-8'), subprocess.run(['gpg', '-dq',
        '/home/ak/.local/share/misc/url-2.gpg'], check=True,
        stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
url_1, url_2 = get_url_1.stdout[:-1], get_url_2.stdout[:-1]
user = subprocess.sys.argv[1]

try:
    tries = subprocess.sys.argv[2]
except IndexError:
    tries = 0

def get_info_1(user):
    r = requests.post(url_1, data={'number': user})
    soup = BeautifulSoup(r.content, 'html.parser')
    for data in soup.find_all('tr'):
        print(data.get_text(separator=': -------> ', strip=True))



def get_info_2(user):
    r = requests.post(url_2, data={'cnnum': user})
    soup = BeautifulSoup(r.content, 'html.parser')
    for data in soup.find_all('tr'):
        print(data.get_text(separator=': -------> ', strip=True))


if tries == str(1):
    get_info_1(user)
elif tries == str(2):
    get_info_2(user)
elif tries == 0:
    get_info_1(user)
    get_info_2(user)
