Skip to content

Instantly share code, notes, and snippets.

@f4814
Created June 6, 2020 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save f4814/cdd8795afffa854f353b439a33f2695d to your computer and use it in GitHub Desktop.
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.
# 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