Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate limit bypassed ⚡ #168

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions bot/core/tapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import asyncio
import asyncio, random
from time import time
from random import randint
from datetime import datetime
Expand Down Expand Up @@ -472,7 +472,13 @@ async def run(self, proxy: str | None):
continue

http_client.headers["Authorization"] = f"Bearer {access_token}"

ip="%s.%s.%s.%s"%(random.randint(1,225),random.randint(1,225),random.randint(1,225),random.randint(1,225))
http_client.headers['X-Forwarded-For'] = ip
http_client.headers['X-Forwarded-Host']= ip
http_client.headers['X-Client-IP'] = ip
http_client.headers['X-Remote-IP'] = ip
http_client.headers['X-Remote-Addr'] = ip
http_client.headers['X-Host'] = ip
access_token_created_time = time()

await self.get_telegram_me(http_client=http_client)
Expand Down Expand Up @@ -705,6 +711,13 @@ async def run(self, proxy: str | None):
raise error
else:
logger.error(f"{self.session_name} | ⚠ Warning! Invalid protocol detected in {error}")
ip="%s.%s.%s.%s"%(random.randint(1,225),random.randint(1,225),random.randint(1,225),random.randint(1,225))
http_client.headers['X-Forwarded-For'] = ip
http_client.headers['X-Forwarded-Host']= ip
http_client.headers['X-Client-IP'] = ip
http_client.headers['X-Remote-IP'] = ip
http_client.headers['X-Remote-Addr'] = ip
http_client.headers['X-Host'] = ip
await asyncio.sleep(delay=randint(a=3, b=7))

except InvalidSession as error:
Expand Down