"fetch_blocks",
help="Fetches blocks from registered instances (run command fetch_instances first!).",
)
- parser.add_argument("--domain", help="Instance name (aka. domain) to fetch blocks from")
+ parser.add_argument("--domain", help="Instance name (aka. domain)")
+ parser.add_argument("--software", help="Name of software, e.g. 'lemmy'")
parser.set_defaults(command=commands.fetch_blocks)
### Fetch blocks from chaos.social ###
fba.cursor.execute(
"SELECT domain, software, origin, nodeinfo_url FROM instances WHERE domain = ?", [args.domain]
)
+ elif args.software is not None and args.software != "":
+ # Re-check single software
+ # DEBUG: print(f"DEBUG: Querying database for args.software='{args.software}' ...")
+ fba.cursor.execute(
+ "SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software = ?", [args.software]
+ )
else:
# Re-check after "timeout" (aka. minimum interval)
fba.cursor.execute(
import bs4
import reqto
+import validators
from fba import config
from fba import network
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
elif domain == "":
raise ValueError("Parameter 'domain' is empty")
+ elif not validators.domain(domain.split("/")[0]):
+ raise ValueError(f"domain='{domain}' is not a valid domain")
+ elif domain.endswith(".arpa"):
+ raise ValueError(f"domain='{domain}' is a domain for reversed IP addresses, please don't crawl them!")
elif domain.endswith(".tld"):
raise ValueError(f"domain='{domain}' is a fake domain, please don't crawl them!")
elif not isinstance(headers, dict):
return
elif not validators.domain(domain.split("/")[0]):
raise ValueError(f"domain='{domain}' is not a valid domain")
+ elif domain.endswith(".arpa"):
+ raise ValueError(f"domain='{domain}' is a domain for reversed IP addresses, please don't crawl them!")
elif domain.endswith(".tld"):
raise ValueError(f"domain='{domain}' is a fake domain")
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-import sys
import time
import validators
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import json
-import sys
import time
import requests
raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
elif domain == "":
raise ValueError("Parameter 'domain' is empty")
+ elif not validators.domain(domain.split("/")[0]):
+ raise ValueError(f"domain='{domain}' is not a valid domain")
+ elif domain.endswith(".arpa"):
+ raise ValueError(f"domain='{domain}' is a domain for reversed IP addresses, please don't crawl them!")
elif domain.endswith(".tld"):
raise ValueError(f"domain='{domain}' is a fake domain, please don't crawl them!")
elif not isinstance(blocklist, dict):