Skip to content

Instantly share code, notes, and snippets.

@DomathID
Forked from zevtyardt/ghkmrvprflvws.py
Created September 26, 2023 07:49
Show Gist options
  • Save DomathID/35415f134da8c5661f584d70153db44c to your computer and use it in GitHub Desktop.
Save DomathID/35415f134da8c5661f584d70153db44c to your computer and use it in GitHub Desktop.
github profile views
import requests
import re
import time
import user_agent
import math
import threading
from rich.live import Live
from rich.table import Table
# TAHAN ICON TOTAL VIEWS, SALIN LINK, PASTE DIBAWAH
url = ''
total_bandwidth = 0
matches = "0"
thread = "~"
lock = threading.Lock()
def convert_size(size_bytes):
if size_bytes == 0:
return "0 B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
p = math.pow(1024, i)
size = round(size_bytes / p, 5)
return f"{size} {size_name[i]}"
def format_time(seconds):
intervals = (
('tahun', 31536000), # 60 * 60 * 24 * 365
('bulan', 2592000), # 60 * 60 * 24 * 30
('minggu', 604800), # 60 * 60 * 24 * 7
('hari', 86400), # 60 * 60 * 24
('jam', 3600), # 60 * 60
('menit', 60),
('detik', 1),
)
result = []
for name, count in intervals:
value = seconds // count
if value:
seconds -= value * count
if value == 1:
name = name.rstrip('s')
result.append("{} {}".format(int(value), name))
if len(result) == 0:
return "0 detik"
return ', '.join(result)
def worker(i):
global total_bandwidth, matches, thread
while True:
ua = user_agent.generate_user_agent()
headers = {
'Host': 'camo.githubusercontent.com',
'User-Agent': ua,
'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
}
response = requests.get(url, headers=headers)
response_text = response.text
response_size = len(response_text)
with lock:
total_bandwidth += response_size + \
int(response.headers.get('content-length', 0))
pattern = r'(?<=<title>)([^<]+)(?=<\/title>)'
matches = re.findall(pattern, response_text)[0].split(": ")[-1]
thread = str(i)
for i in range(10):
th = threading.Thread(target=worker, args=(i,), daemon=True)
th.start()
print("\x1bc" + "\n" * 10)
with Live(auto_refresh=500) as live:
start_time = time.time()
live.console.print("\n[green] GITHUB KOMAREV AUTO VIEWS[reset]\n")
try:
while True:
table = Table.grid(pad_edge=2)
table.add_row(" ", "UPTIME", format_time(time.time() - start_time))
table.add_row("", "THREAD", thread)
table.add_row("", "BANDWIDTH", convert_size(total_bandwidth))
table.add_row("", "TOTAL VIEWS ", matches)
live.update(table)
except (Exception, KeyboardInterrupt):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment