Найти в Дзене
CryptoRenaissance XXl

No views

No views. Here is the original file main: from threading import Thread, active_count from time import sleep as wait from auto_proxy import Proxy from telegram import Api from utility import * print(LOGO) channel, post = input_loader() http, socks4, socks5 = config_loader() auto_proxies, telegram_api = ( Proxy( http_sources=http, socks4_sources=socks4, socks5_sources=socks5 ), Api() ) telegram_api.init(channel, post) def view_updater(): while True: try: Api.views(telegram_api) wait(2) except Exception as e: logger(e) def cli(): _display = display() while True: try: system('cls' if name == 'nt' else 'clear') _display() wait(2) except Exception as e: logger(e) Thread(target=view_updater).start() Thread(target=cli).start() def start(): threads = [] auto_proxies.init() for proxy_type, proxy in auto_proxies.proxies: while active_count() > THREADS: wait(0.05) thread = Thread( target=telegram_api.send_view, args=(proxy, proxy_type) ) threads.append(thread)

No views. Here is the original file main:

from threading import Thread, active_count

from time import sleep as wait

from auto_proxy import Proxy

from telegram import Api

from utility import *

print(LOGO)

channel, post = input_loader()

http, socks4, socks5 = config_loader()

auto_proxies, telegram_api = (

Proxy(

http_sources=http, socks4_sources=socks4, socks5_sources=socks5 ), Api()

)

telegram_api.init(channel, post)

def view_updater():

while True:

try:

Api.views(telegram_api)

wait(2)

except Exception as e:

logger(e)

def cli():

_display = display()

while True:

try:

system('cls' if name == 'nt' else 'clear')

_display()

wait(2)

except Exception as e:

logger(e)

Thread(target=view_updater).start()

Thread(target=cli).start()

def start():

threads = []

auto_proxies.init()

for proxy_type, proxy in auto_proxies.proxies:

while active_count() > THREADS:

wait(0.05)

thread = Thread(

target=telegram_api.send_view, args=(proxy, proxy_type)

)

threads.append(thread)

thread.start()

for t in threads:

t.join()

start()

start()

And here is the file telegram:

import requests

from re import search

class Api:

real_views, proxy_errors, token_errors = 0, 0, 0 def init(self, channel, post):

self.url = 'https://t.me/'

self.channel, self.post = channel, post @classmethod def views(cls, self):

telegram_request = requests.get(

f'{self.url}{self.channel}/{self.post}', params={'embed': '1', 'mode': 'tme'},

headers={

'referer': f'{self.url}{self.channel}/{self.post}', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'

}

)

cls.real_views = search(

'<span class="tgme_widget_message_views">([^<]+)', telegram_request.text ).group(1)

def send_view(self, proxy, proxy_type):

try:

session = requests.session()

response = session.get(

f'{self.url}{self.channel}/{self.post}', params={'embed': '1', 'mode': 'tme'},

headers={

'referer': f'{self.url}{self.channel}/{self.post}', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'

},

proxies={

'http': f'{proxy_type}://{proxy}', 'https': f'{proxy_type}://{proxy}'

},

timeout=15 ) cookies_dict = session.cookies.get_dict()

session.get(

'https://t.me/v/', params={'views': str(search('data-view="([^"]+)', response.text).group(1))}, cookies={

'stel_dt': '-240', 'stel_web_auth': 'https%3A%2F%2Fweb.telegram.org%2Fz%2F',

'stel_ssid': cookies_dict.get('stel_ssid', None), 'stel_on': cookies_dict.get('stel_on', None)

},

headers={

'referer': f'https://t.me/{self.channel}/{self.post}?embed=1&mode=tme',

'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36', 'x-requested-with': 'XMLHttpRequest'

},

proxies={

'http': f'{proxy_type}://{proxy}', 'https': f'{proxy_type}://{proxy}'

},

timeout=15 )

except AttributeError:

Api.token_errors += 1 except requests.exceptions.RequestException:

Api.proxy_errors += 1

Consider adding IPv6 proxy support.