this post was submitted on 15 Jun 2023
37 points (97.4% liked)
FREEMEDIAHECKYEAH
53 readers
1 users here now
๐ฟ ๐บ ๐ต ๐ฎ ๐ ๐ฑ
๐ดโโ ๏ธ Wiki / ๐ฌ Chat
Rules
1. Please be kind and helpful to one another.
2. No racism, sexism, ableism, homophobia, transphobia, spam.
3. Linking to piracy sites is fine, but please keep links directly to pirated content in DMs.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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 usinggit clone https://github.com/LemmyNet/lemmy-stats-crawler.git
. Then, navigate to the cloned directory usingcd lemmy-stats-crawler
and run the commandcargo 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
lemmy.fmhy.ml
. To do this, you can use thejq
command-line tool to filter the JSON file based on the desired criteria. Here's an example script that extracts the instances that are blockinglemmy.fmhy.ml
:This script loads the JSON file into a variable, uses
jq
to filter the instances that are blockinglemmy.fmhy.ml
, 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 useslemmy-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
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: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/