Skip to content

Commit 632f1bf

Browse files
committed
Async Update
0 parents commit 632f1bf

File tree

4 files changed

+291
-0
lines changed

4 files changed

+291
-0
lines changed

auto/http.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
http://proxysearcher.sourceforge.net/Proxy%20List.php?type=http
2+
https://api.proxyscrape.com/v2/?request=getproxies&protocol=http
3+
https://openproxy.space/list/http
4+
https://openproxylist.xyz/http.txt
5+
https://proxyspace.pro/http.txt
6+
https://proxyspace.pro/https.txt
7+
https://rootjazz.com/proxies/proxies.txt
8+
https://sheesh.rip/http.txt
9+
https://spys.me/proxy.txt
10+
https://proxyhub.me/en/all-http-proxy-list.html
11+
https://proxyhub.me/en/all-https-proxy-list.html
12+
https://proxy-tools.com/proxy/http
13+
https://proxy-tools.com/proxy/https
14+
https://www.proxy-list.download/api/v1/get?type=http
15+
https://www.proxy-list.download/api/v1/get?type=https
16+
https://www.proxyscan.io/download?type=http
17+
https://proxylist.geonode.com/api/proxy-list?limit=500&page=1&sort_by=lastChecked&sort_type=desc&protocols=http
18+
https://proxylist.geonode.com/api/proxy-list?limit=500&page=1&sort_by=lastChecked&sort_type=desc&protocols=https
19+
https://raw.githubusercontent.com/almroot/proxylist/master/list.txt
20+
https://raw.githubusercontent.com/aslisk/proxyhttps/main/https.txt
21+
https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/HTTP.txt
22+
https://raw.githubusercontent.com/clarketm/proxy-list/master/proxy-list-raw.txt
23+
https://raw.githubusercontent.com/hanwayTech/free-proxy-list/main/http.txt
24+
https://raw.githubusercontent.com/hanwayTech/free-proxy-list/main/https.txt
25+
https://raw.githubusercontent.com/hendrikbgr/Free-Proxy-Repo/master/proxy_list.txt
26+
https://raw.githubusercontent.com/HyperBeats/proxy-list/main/http.txt
27+
https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt
28+
https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-https.txt
29+
https://raw.githubusercontent.com/mertguvencli/http-proxy-list/main/proxy-list/data.txt
30+
https://raw.githubusercontent.com/mmpx12/proxy-list/master/http.txt
31+
https://raw.githubusercontent.com/mmpx12/proxy-list/master/https.txt
32+
https://raw.githubusercontent.com/roosterkid/openproxylist/main/HTTPS_RAW.txt
33+
https://raw.githubusercontent.com/saisuiu/uiu/main/free.txt
34+
https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/http.txt
35+
https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/http.txt
36+
https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/https.txt
37+
https://raw.githubusercontent.com/sunny9577/proxy-scraper/master/proxies.txt
38+
https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt

auto/socks4.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
http://proxysearcher.sourceforge.net/Proxy%20List.php?type=socks
2+
https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks4
3+
https://openproxy.space/list/socks4
4+
https://openproxylist.xyz/socks4.txt
5+
https://proxyspace.pro/socks4.txt
6+
https://spys.me/socks.txt
7+
https://www.proxy-list.download/api/v1/get?type=socks4
8+
https://www.proxyscan.io/download?type=socks4
9+
https://proxyhub.me/en/all-socks4-proxy-list.html
10+
https://proxy-tools.com/proxy/socks4
11+
https://proxylist.geonode.com/api/proxy-list?limit=500&page=1&sort_by=lastChecked&sort_type=desc&protocols=socks4
12+
https://www.socks-proxy.net/
13+
https://www.my-proxy.com/free-socks-4-proxy.html
14+
https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/SOCKS4.txt
15+
https://raw.githubusercontent.com/hanwayTech/free-proxy-list/main/socks4.txt
16+
https://raw.githubusercontent.com/HyperBeats/proxy-list/main/socks4.txt
17+
https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks4.txt
18+
https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks4.txt
19+
https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS4_RAW.txt
20+
https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/socks4.txt
21+
https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks4.txt
22+
https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt

auto/socks5.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
http://proxysearcher.sourceforge.net/Proxy%20List.php?type=socks
2+
https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks5
3+
https://openproxy.space/list/socks5
4+
https://openproxylist.xyz/socks5.txt
5+
https://proxyspace.pro/socks5.txt
6+
https://spys.me/socks.txt
7+
https://www.proxy-list.download/api/v1/get?type=socks5
8+
https://www.proxyscan.io/download?type=socks5
9+
https://proxy-tools.com/proxy/socks5
10+
https://proxyhub.me/en/all-sock5-proxy-list.html
11+
https://www.my-proxy.com/free-socks-5-proxy.html
12+
https://proxylist.geonode.com/api/proxy-list?limit=500&page=1&sort_by=lastChecked&sort_type=desc&protocols=socks5
13+
https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/SOCKS5.txt
14+
https://raw.githubusercontent.com/hanwayTech/free-proxy-list/main/socks5.txt
15+
https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt
16+
https://raw.githubusercontent.com/HyperBeats/proxy-list/main/socks5.txt
17+
https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt
18+
https://raw.githubusercontent.com/manuGMG/proxy-365/main/SOCKS5.txt
19+
https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks5.txt
20+
https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt
21+
https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/socks5.txt
22+
https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks5.txt
23+
https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt

tviews.py

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
import aiohttp, asyncio
2+
from re import search
3+
from aiohttp_socks import ProxyConnector
4+
from argparse import ArgumentParser
5+
from re import compile
6+
from os import system, name
7+
from threading import Thread
8+
from time import sleep
9+
10+
11+
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
12+
REGEX = compile(
13+
r"(?:^|\D)?(("+ r"(?:[1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])"
14+
+ r"\." + r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])"
15+
+ r"\." + r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])"
16+
+ r"\." + r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])"
17+
+ r"):" + (r"(?:\d|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{3}"
18+
+ r"|65[0-4]\d{2}|655[0-2]\d|6553[0-5])")
19+
+ r")(?:\D|$)"
20+
)
21+
22+
23+
class Telegram:
24+
def __init__(self, channel: str, post: int) -> None:
25+
self.tasks = 500
26+
self.channel = channel
27+
self.post = post
28+
29+
self.cookie_error = 0
30+
self.sucsess_sent = 0
31+
self.failled_sent = 0
32+
self.unkown_error = 0
33+
self.token_error = 0
34+
self.proxy_error = 0
35+
36+
37+
async def request(self, proxy: str, proxy_type: str):
38+
if proxy_type == 'socks4': connector = ProxyConnector.from_url(f'socks4://{proxy}')
39+
elif proxy_type == 'socks5': connector = ProxyConnector.from_url(f'socks5://{proxy}')
40+
elif proxy_type == 'https': connector = ProxyConnector.from_url(f'https://{proxy}')
41+
else: connector = ProxyConnector.from_url(f'http://{proxy}')
42+
43+
jar = aiohttp.CookieJar(unsafe=True)
44+
async with aiohttp.ClientSession(cookie_jar=jar, connector=connector) as session:
45+
try:
46+
async with session.get(
47+
f'https://t.me/{self.channel}/{self.post}?embed=1&mode=tme',
48+
headers={
49+
'referer': f'https://t.me/{self.channel}/{self.post}',
50+
'user-agent': user_agent
51+
}, timeout=aiohttp.ClientTimeout(total=5)
52+
) as embed_response:
53+
if jar.filter_cookies(embed_response.url).get('stel_ssid'):
54+
views_token = search('data-view="([^"]+)"', await embed_response.text())
55+
if views_token:
56+
views_response = await session.post(
57+
'https://t.me/v/?views=' + views_token.group(1),
58+
headers={
59+
'referer': f'https://t.me/{self.channel}/{self.post}?embed=1&mode=tme',
60+
'user-agent': user_agent, 'x-requested-with': 'XMLHttpRequest'
61+
}, timeout=aiohttp.ClientTimeout(total=5)
62+
)
63+
if (
64+
await views_response.text() == "true"
65+
and views_response.status == 200
66+
): self.sucsess_sent += 1
67+
else: self.failled_sent += 1
68+
else: self.token_error += 1
69+
else: self.cookie_error += 1
70+
except: self.proxy_error += 1
71+
finally: jar.clear()
72+
73+
74+
def run_proxies_tasks(self, lines: list, proxy_type):
75+
async def inner(proxies: list):
76+
await asyncio.wait(
77+
[asyncio.create_task(self.request(proxy, proxy_type))
78+
for proxy in proxies]
79+
)
80+
81+
chunks = [lines[i:i+self.tasks] for i in range(0, len(lines), self.tasks)]
82+
for chunk in chunks: asyncio.run(inner(chunk))
83+
84+
85+
def run_auto_tasks(self):
86+
while True:
87+
async def inner(proxies: tuple):
88+
await asyncio.wait(
89+
[asyncio.create_task(self.request(proxy, proxy_type))
90+
for proxy_type, proxy in proxies]
91+
)
92+
93+
auto = Auto()
94+
chunks = [auto.proxies[i:i+self.tasks] for i in range(0, len(auto.proxies), self.tasks)]
95+
for chunk in chunks: asyncio.run(inner(chunk))
96+
97+
98+
async def run_rotated_task(self, proxy, proxy_type):
99+
while True:
100+
await asyncio.wait(
101+
[asyncio.create_task(self.request(proxy, proxy_type))
102+
for _ in range(self.tasks)]
103+
)
104+
105+
106+
def cli(self):
107+
logo = '''
108+
~ Telegram Auto Views V4 ~
109+
~ github.com/TeaByte ~
110+
~ @TeaByte ~
111+
'''
112+
while not self.sucsess_sent:
113+
print(logo)
114+
print('\n\n [ Waiting... ]\r')
115+
sleep(0.3);system('cls' if name=='nt' else 'clear')
116+
117+
while True:
118+
print(logo)
119+
print(f'''
120+
DATA:
121+
@{self.channel}/{self.post}
122+
Sent: {self.sucsess_sent}
123+
Fail: {self.failled_sent}
124+
125+
ERRORS:
126+
Proxy Error: {self.proxy_error}
127+
Token Error: {self.token_error}
128+
Cookie Error: {self.cookie_error}
129+
Unkown Error: {self.unkown_error}
130+
''')
131+
sleep(0.3);system('cls' if name=='nt' else 'clear')
132+
133+
134+
class Auto:
135+
def __init__(self):
136+
self.proxies = []
137+
try:
138+
with open(f'auto/http.txt', 'r') as file:
139+
self.http_sources = file.read().splitlines()
140+
141+
with open(f'auto/socks4.txt', 'r') as file:
142+
self.socks4_sources = file.read().splitlines()
143+
144+
with open(f'auto/http.txt', 'r') as file:
145+
self.socks5_sources = file.read().splitlines()
146+
147+
except FileNotFoundError:
148+
print(' [ Error ] auto file not found!')
149+
exit()
150+
151+
print(' [ WAIT ] Scraping proxies... ')
152+
asyncio.run(self.init())
153+
154+
155+
async def scrap(self, source_url, proxy_type):
156+
try:
157+
async with aiohttp.ClientSession() as session:
158+
async with session.get(
159+
source_url,
160+
headers={'user-agent': user_agent},
161+
timeout=aiohttp.ClientTimeout(total=15)
162+
) as response:
163+
html = await response.text()
164+
if tuple(REGEX.finditer(html)):
165+
for proxy in tuple(REGEX.finditer(html)):
166+
self.proxies.append( (proxy_type, proxy.group(1)) )
167+
except Exception as e:
168+
with open('error.txt', 'a', encoding='utf-8', errors='ignore') as f:
169+
f.write(f'{source_url} -> {e}\n')
170+
171+
172+
async def init(self):
173+
tasks = []
174+
self.proxies.clear()
175+
for sources in (
176+
(self.http_sources, 'http'),
177+
(self.socks4_sources, 'socks4'),
178+
(self.socks5_sources, 'socks5')
179+
):
180+
srcs, proxy_type = sources
181+
for source_url in srcs:
182+
task = asyncio.create_task(
183+
self.scrap(source_url, proxy_type)
184+
)
185+
tasks.append(task)
186+
await asyncio.wait(tasks)
187+
188+
189+
parser = ArgumentParser()
190+
parser.add_argument('-c', '--channel', dest='channel', help='Channel user', type=str, required=True)
191+
parser.add_argument('-pt', '--post', dest='post', help='Post number', type=int, required=True)
192+
parser.add_argument('-t', '--type', dest='type', help='Proxy type', type=str, required=False)
193+
parser.add_argument('-m', '--mode', dest='mode', help='Proxy mode', type=str, required=True)
194+
parser.add_argument('-p', '--proxy', dest='proxy', help='Proxy file path or user:password@host:port', type=str, required=False)
195+
args = parser.parse_args()
196+
197+
api = Telegram(args.channel, args.post)
198+
Thread(target=api.cli).start()
199+
200+
if args.mode[0] == "l":
201+
with open(args.proxy, 'r') as file:
202+
lines = file.read().splitlines()
203+
api.run_proxies_tasks(lines, args.type)
204+
205+
elif args.mode[0] == "r":
206+
asyncio.run(api.run_rotated_task(args.proxy, args.type))
207+
208+
else: api.run_auto_tasks()

0 commit comments

Comments
 (0)