-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathfind-closed-discussions.py
More file actions
executable file
·36 lines (25 loc) · 1 KB
/
Copy pathfind-closed-discussions.py
File metadata and controls
executable file
·36 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/env python3
from ws.client import API
from ws.db.database import Database
def main(api: API, db: Database) -> None:
db.sync_with_api(api)
db.sync_revisions_content(api, mode="latest")
db.update_parser_cache()
namespaces = ["1", "5", "11", "13", "15"]
talks = set()
for ns in namespaces:
for page in db.query(generator="allpages", gapnamespace=ns, prop="sections", secprop={"title"}):
for section in page.get("sections", []):
if section["title"].startswith("<s>") and section["title"].endswith("</s>"):
talks.add(page["title"])
for talk in sorted(talks):
print(f"* [[{talk}]]")
if __name__ == "__main__":
import ws.config
argparser = ws.config.getArgParser(description="Find closed discussions")
API.set_argparser(argparser)
Database.set_argparser(argparser)
args = ws.config.parse_args(argparser)
api = API.from_argparser(args)
db = Database.from_argparser(args)
main(api, db)