import json import account import requests # Plugin Data info = { "name": "Clean Domain List", "description": "Remove existing domains from domain list", "version": "1.0", "author": "Nathan.Woodburn/" } # Functions functions = { "main":{ "name": "Clean list", "type": "default", "description": "Paste list here and clean", "params": { "list": { "name": "List", "type": "longText", } }, "returns": { "status": { "name": "Status of the function", "type": "text" }, "domains": { "name": "List of domains", "type": "text" }, "removed": { "name": "Removed domains", "type": "list" } } } } def main(params, authentication): domains = params["list"].split("\n") domains = [domain.strip() for domain in domains] domains = [domain for domain in domains if domain != ""] finalList = [] removedList = [] for domain in domains: if domain not in finalList: # Check if domain exists already info = account.getDomain(domain) if 'error' in info: removedList.append(domain) print(f"Domain {domain} error") continue if 'info' in info: if info['info'] is not None: removedList.append(domain) print(f"Domain {domain} has info") continue finalList.append(domain) finalList = "
".join(finalList) removed = [f"
Domain: {domain}  Info: {account.getDomain(domain)}
" for domain in removedList] return {"status": "Success","domains": finalList, "removed": removed}