fix max lenght message
This commit is contained in:
parent
19af8cdbed
commit
6b3ef3d102
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
datetime.json
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
@ -1 +1 @@
|
||||
"2022-06-24 22:11:28.713372"
|
||||
"2023-02-01 22:11:28.713372"
|
||||
|
2
main.py
2
main.py
@ -35,6 +35,8 @@ def main():
|
||||
while row:
|
||||
soup = BeautifulSoup(row[2], features="html.parser")
|
||||
textNews = soup.get_text('\n').replace("\n\n\n\n", "\n").replace("\n\n\n", "\n").replace("\n\n", "\n")
|
||||
if len(textNews) > 3000:
|
||||
textNews = textNews[:3000] + '...'
|
||||
params = {'chat_id': messageTo.get('is'),
|
||||
'text': f'{row[1]}\n{textNews}\nhttp://is.ulstu.ru/News/ShowNews/{row[0]}'}
|
||||
requests.get('https://api.telegram.org/bot5567223643:AAG6DYNUNq7BNqm7-pI2p-SdvEmAKielViE/sendMessage',
|
||||
|
Loading…
x
Reference in New Issue
Block a user