Added memory.lol (Twitter usernames archive) (#1067)

This commit is contained in:
Soxoj
2023-07-24 12:57:45 +06:00
committed by GitHub
parent 656b9c19ea
commit f5ca005766
3 changed files with 39 additions and 2 deletions
+10 -1
View File
@@ -6,6 +6,7 @@ try:
except ImportError: except ImportError:
from unittest.mock import Mock from unittest.mock import Mock
import ast
import re import re
import ssl import ssl
import sys import sys
@@ -374,8 +375,16 @@ def process_site_result(
if extracted_ids_data: if extracted_ids_data:
new_usernames = {} new_usernames = {}
for k, v in extracted_ids_data.items(): for k, v in extracted_ids_data.items():
if "username" in k: if "username" in k and not "usernames" in k:
new_usernames[v] = "username" new_usernames[v] = "username"
elif "usernames" in k:
try:
tree = ast.literal_eval(v)
if type(tree) == list:
for n in tree:
new_usernames[n] = "username"
except Exception as e:
logger.warning(e)
if k in SUPPORTED_IDS: if k in SUPPORTED_IDS:
new_usernames[v] = k new_usernames[v] = k
+11 -1
View File
@@ -1,6 +1,7 @@
""" """
Maigret main module Maigret main module
""" """
import ast
import asyncio import asyncio
import logging import logging
import os import os
@@ -85,8 +86,17 @@ def extract_ids_from_page(url, logger, timeout=5) -> dict:
else: else:
print(get_dict_ascii_tree(info.items(), new_line=False), ' ') print(get_dict_ascii_tree(info.items(), new_line=False), ' ')
for k, v in info.items(): for k, v in info.items():
if 'username' in k: # TODO: merge with the same functionality in checking module
if 'username' in k and not 'usernames' in k:
results[v] = 'username' results[v] = 'username'
elif 'usernames' in k:
try:
tree = ast.literal_eval(v)
if type(tree) == list:
for n in tree:
results[n] = 'username'
except Exception as e:
logger.warning(e)
if k in SUPPORTED_IDS: if k in SUPPORTED_IDS:
results[v] = k results[v] = k
+18
View File
@@ -24135,6 +24135,24 @@
"usernameUnclaimed": "noonewouldeverusethis7", "usernameUnclaimed": "noonewouldeverusethis7",
"usernameClaimed": "alex" "usernameClaimed": "alex"
}, },
"memory.lol": {
"tags": [
"messaging"
],
"regexCheck": "^[a-zA-Z0-9_]{1,15}$",
"checkType": "message",
"absenceStrs": [
"{\"accounts\":[]}"
],
"presenseStrs": [
"{\"accounts\":[{"
],
"source": "Twitter",
"urlMain": "https://memory.lol",
"url": "https://api.memory.lol/v1/tw/{username}",
"usernameClaimed": "libsoftiktok",
"usernameUnclaimed": "noonewould123"
},
"metroman.3dn.ru": { "metroman.3dn.ru": {
"engine": "uCoz", "engine": "uCoz",
"urlMain": "http://metroman.3dn.ru", "urlMain": "http://metroman.3dn.ru",