Created
June 6, 2020 11:19
-
-
Save f4814/cdd8795afffa854f353b439a33f2695d to your computer and use it in GitHub Desktop.
Quick&Dirty script to create a mediawiki table containing all rooms in a matrix community.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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