Skip to content

Commit 08bb326

Browse files
authored
Merge pull request vwh#53 from Tsprnay/patch-1
Update tviews.py
2 parents 6eac6c7 + 1afac49 commit 08bb326

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tviews.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from os import system, name
77
from threading import Thread
88
from time import sleep
9+
from fake_useragent import UserAgent
910

1011

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"
1212
REGEX = compile(
1313
r"(?:^|\D)?(("+ r"(?:[1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])"
1414
+ r"\." + r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])"
@@ -44,6 +44,7 @@ async def request(self, proxy: str, proxy_type: str):
4444
jar = aiohttp.CookieJar(unsafe=True)
4545
async with aiohttp.ClientSession(cookie_jar=jar, connector=connector) as session:
4646
try:
47+
user_agent = UserAgent().random
4748
async with session.get(
4849
f'https://t.me/{self.channel}/{self.post}?embed=1&mode=tme',
4950
headers={
@@ -152,7 +153,7 @@ async def scrap(self, source_url, proxy_type):
152153
async with aiohttp.ClientSession() as session:
153154
async with session.get(
154155
source_url,
155-
headers={'user-agent': user_agent},
156+
headers={'user-agent': UserAgent().random},
156157
timeout=aiohttp.ClientTimeout(total=15)
157158
) as response:
158159
html = await response.text()

0 commit comments

Comments
 (0)