From 4503617d198219f72e27efbde60248166129b0d7 Mon Sep 17 00:00:00 2001 From: Soxoj <31013580+soxoj@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:46:32 +0600 Subject: [PATCH] Added memory.lol (#156) --- socid_extractor/schemes.py | 9 +++++++++ tests/test_e2e.py | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/socid_extractor/schemes.py b/socid_extractor/schemes.py index ee36079..9b53247 100644 --- a/socid_extractor/schemes.py +++ b/socid_extractor/schemes.py @@ -1809,5 +1809,14 @@ 'registered_domains': lambda x: [i["productCode"] for i in x["exact"] if i["status"] == "registered"], 'protected_domains': lambda x: [i["productCode"] for i in x["exact"] if i["status"] == "protected"], } + }, + 'memory.lol': { + 'flags': ['{"accounts":[{'], + 'regex': r'^({[\S\s]+?})$', + 'extract_json': True, + 'fields': { + 'id': lambda x: x['accounts'][0]['id'], + 'known_usernames': lambda x: [i for i in x['accounts'][0]['screen_names']], + } } } diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 21bc09a..7c5142c 100755 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -1220,3 +1220,10 @@ def test_aparat_api(): assert info.get("links") == "['https://sibmo.ir/bigmj', 'http://www.telegram.me/amobig', 'http://www.instagram.com/amobigstream']" assert 'video_count' in info assert info.get("bio") == "چنل تلگرام:\r\nhttps://t.me/amobig" + + +def test_memory_lol(): + info = extract(parse('https://api.memory.lol/v1/tw/libsoftiktok')[0]) + + assert info.get("id") == "1326229737551912960" + assert info.get("known_usernames") == "['shaya69830552', 'shaya_ray', 'chayaraichik', 'chayathepatriot', 'cuomomustgo', 'houseplantpotus', 'libsoftiktok']"