Who blocks FMHY
Who blocks FMHY
Some delightful comments by them https://web.archive.org/web/20230608014753/https://lemmygrad.ml/post/668436
We’ll go through each account application with due diligence, but we would like you to know before you request an account that Lemmygrad is a Marxist instance, principally Marxist-Leninist. We like Stalin and we uphold the DPRK’s sovereignty and legitimacy over the whole of Korea. We love China’s Socialism with Chinese Characteristics.
By experience, most internet users who self-identified as Communists and oppose Stalin tend to be either brainwashed people in countries that are under the rule of Westen European diaspora or trolling bots. Is there any real Communists who actually oppose Stalin? Stalin receive the most slander in Western European diaspora because he refused the destruction of USSR through an unsustainable war against Fascism and he forced the desolution of alliance by British and French empires with Hitler’s Nazi Germany. The Liberals complained about the non-agreession pact between Stalin and Hitler, even when the Western European empires forced Stalin to make the peace pact, that buy time for war preparation by USSR against Hitler at a time when USSR is too underindustrialized and too devasted from the Russian civial war that was more damaging than World War 1.
DPR Korea isn’t sovereign over the whole of Korea. Not yet, anyway. Hopefully soon.
2 questions.
Fmhy.ml is an entirely separate instance from Lemmy.ml right? Lil confused cuz those are the only ones I've seen ending in ml
What instance do we have blocked?
This is wrong but if you ask a chatbot multiple times perhaps it gives the correct answer:
To accomplish this task, you can use the lemmy-stats-crawler tool available on GitHub. First, clone the repository using git clone https://github.com/LemmyNet/lemmy-stats-crawler.git. Then, navigate to the cloned directory using cd lemmy-stats-crawler and run the command cargo run -- --json > stats.json to generate a JSON file containing the stats.
Next, you can create a script to extract the instances that are blocking fmhy. To do this, you can use the jq command-line tool to filter the JSON file based on the desired criteria. Here's an example script that extracts the instances that are blocking fmhy:
#!/bin/bash
# Load the JSON file into a variable
stats=$(cat stats.json)
# Extract the instances that are blocking fmhy
blocked_instances=$(echo "$stats" | jq '.[] | select(.blocking | contains(["fmhy"])) | .instance')
# Print the results
echo "Instances blocking fmhy:"
echo "$blocked_instances"
This script loads the JSON file into a variable, uses jq to filter the instances that are blocking fmhy, and prints the results. You can modify the script to extract other information from the JSON file as needed.
Note that there is also a separate GitHub repository called lemmy-instance-stats that uses lemmy-stats-crawler to generate a JSON file of Lemmy instance statistics[1]. You may find this repository useful as well.
Citations: [1] https://github.com/LemmyNet/lemmy-instance-stats> Who blocks FMHY
This one is also wrong:
To extract the list of instances blocking a given instance from the provided JSON structure, you can use the json module in Python. Here's a script that does that:
import json
# Load the JSON data
json_data = '''
{
"instance_details": [
{
"domain": "lemmy.world",
"site_info": {
"federated_instances": {
"blocked": [
"burggit.moe"
]
}
}
},
{
"domain": "lemmy.fmhy.ml",
"site_info": {
"federated_instances": {
"blocked": [
"example1.com",
"example2.com"
]
}
}
}
]
}
'''
# Parse the JSON data
data = json.loads(json_data)
# Function to get blocked instances for a given domain
def get_blocked_instances(domain):
for instance in data["instance_details"]:
if instance["domain"] == domain:
return instance["site_info"]["federated_instances"]["blocked"]
return None
# User input
instance_to_check = "lemmy.fmhy.ml"
# Get the list of blocked instances
blocked_instances = get_blocked_instances(instance_to_check)
# Print the result
if blocked_instances is not None:
print(f"Blocked instances for {instance_to_check}:")
for instance in blocked_instances:
print(f"- {instance}")
else:
print(f"No instance found for {instance_to_check}")
This script first loads the JSON data and parses it into a Python dictionary. Then, it defines a function get_blocked_instances that takes a domain as input and returns the list of blocked instances for that domain. Finally, it takes the user input for the instance to check and prints the list of blocked instances for that domain.
Citations:
[1] https://stackoverflow.com/questions/14048948/how-to-find-a-particular-json-value-by-key
[2] https://ankushkunwar7777.medium.com/get-data-from-large-nested-json-file-cf1146aa8c9e
[3] https://www.geeksforgeeks.org/read-json-file-using-python/
[4] https://pynative.com/python-check-if-key-exists-in-json-and-iterate-the-json-array/
[5] https://hackersandslackers.com/extract-data-from-complex-json-python/
To accomplish this task, you can use the lemmy-stats-crawler tool available on GitHub. First, clone the repository using git clone https://github.com/LemmyNet/lemmy-stats-crawler.git. Then, navigate to the cloned directory using cd lemmy-stats-crawler and run the command cargo run -- --json > stats.json to generate a JSON file containing the stats.
To extract the list of instances blocking a given instance from a stats.json file similar to the one you provided, you can use the json module in Python. Here's a script that takes user input and returns the list of instances blocking the given instance:
import json
#with open("stats.json", "r") as file:
# json_data = json.load(file)
json_data = '''
{
"instance_details": [
{
"domain": "lemmy.world",
"site_info": {
"federated_instances": {
"blocked": [
"burggit.moe"
]
}
}
},
{
"domain": "lemmy.ml",
"site_info": {
"federated_instances": {
"blocked": [
"lemmy.fmhy.ml",
"example2.com"
]
}
}
}
]
}
'''
def find_blocking_instances(target_instance, json_data):
data = json.loads(json_data)
blocking_instances = []
for instance in data["instance_details"]:
if target_instance in instance["site_info"]["federated_instances"]["blocked"]:
blocking_instances.append(instance["domain"])
return blocking_instances
user_input = input("Enter the instance to find blocking instances: ")
result = find_blocking_instances(user_input, json_data)
print("Instances blocking", user_input, ":", result)
When you run this script and input lemmy.fmhy.ml, it will output:
Instances blocking lemmy.fmhy.ml : ['lemmy.ml']
This script first loads the JSON data into a Python dictionary using json.loads() [1]. Then, it iterates through the instance_details list and checks if the given instance is in the blocked list of each instance. If it is, the domain of the blocking instance is added to the blocking_instances list. Finally, the script prints the list of instances blocking the given instance.
Citations: [1] https://pynative.com/python/json/
import json
with open("stats.json", "r") as file:
data = json.load(file)
def find_blocking_instances(target_instance, data):
blocking_instances = []
for instance in data["instance_details"]:
federated_instances = instance["site_info"]["federated_instances"]
if federated_instances is not None and target_instance in (federated_instances.get("blocked") or []):
blocking_instances.append(instance["domain"])
return blocking_instances
def print_instance_activity(instance):
domain = instance["domain"]
counts = instance["site_info"]["site_view"]["counts"]
print(f"{domain} ({counts['users_active_day']} users / day, {counts['users_active_week']} users / week, {counts['users_active_month']} users / month, {counts['users_active_half_year']} users / half year)")
user_input = input("Enter the instance to find blocking instances: ")
blocking_instances = find_blocking_instances(user_input, data)
print("Instances blocking", user_input, ":")
for domain in blocking_instances:
for instance in data["instance_details"]:
if instance["domain"] == domain:
print_instance_activity(instance)