fix: [telegram module] check username length

This commit is contained in:
Terrtia 2020-05-11 14:28:18 +02:00
parent 0d67ad80d1
commit 3af5c4bafa
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -51,7 +51,8 @@ def extract_data_from_telegram_url(item_id, item_date, base_url, url_path):
username = url_path[0].lower() username = url_path[0].lower()
username = regex_username.search(username) username = regex_username.search(username)
if username: if username:
username = username[0] username = username[0].replace('/', '')
if len(username) > 5:
print('username: {}'.format(username)) print('username: {}'.format(username))
telegram.save_item_correlation(username, item_id, item_date) telegram.save_item_correlation(username, item_id, item_date)
elif url_path[0] == 'joinchat': elif url_path[0] == 'joinchat':
@ -75,7 +76,8 @@ def extract_data_from_tg_url(item_id, item_date, tg_link):
username = url.query[7:] username = url.query[7:]
username = regex_username.search(username) username = regex_username.search(username)
if username: if username:
username = username[0] username = username[0].replace('/', '')
if len(username) > 5:
print('username: {}'.format(username)) print('username: {}'.format(username))
telegram.save_item_correlation(username, item_id, item_date) telegram.save_item_correlation(username, item_id, item_date)
elif url.netloc == 'join' and len(url.query) > 7: elif url.netloc == 'join' and len(url.query) > 7: