Quick&Dirty script to create a mediawiki table containing all rooms in a matrix community.
# Run like this: | |
# curl "https://[matrixserver]/_matrix/client/r0/groups/+chaos.jetzt:chaos.jetzt/rooms?access_token=[your token here] | python chaos.jetzt-community-to-mediawiki.py | |
import json | |
import sys | |
data = json.load(sys.stdin) | |
for room in data['chunk']: | |
try: | |
topic = room['topic'] | |
except KeyError: | |
room['topic'] = "" | |
print("| {} | {} | <nowiki> {} </nowiki> |".format(room['name'], '[[https://matrix.to/#/'+room['canonical_alias']+"|"+room['canonical_alias']+"]]", room['topic'].replace('\n', ' '))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment