need to clean up title by removing certain characters
This commit is contained in:
parent
2e93aaa9bc
commit
ac76474030
@ -20,7 +20,7 @@ def output_forum (data, destination):
|
|||||||
for category in data.categories:
|
for category in data.categories:
|
||||||
os.makedirs(os.path.join(destination, category.title))
|
os.makedirs(os.path.join(destination, category.title))
|
||||||
for board in category.children:
|
for board in category.children:
|
||||||
output_board(board, os.path.join(destination, category.title, board.title))
|
output_board(board, os.path.join(destination, category.title, __sanitize_title(board.title)))
|
||||||
|
|
||||||
def output_board (data, destination):
|
def output_board (data, destination):
|
||||||
os.makedirs(destination)
|
os.makedirs(destination)
|
||||||
@ -32,8 +32,11 @@ def output_board (data, destination):
|
|||||||
}, indent=4))
|
}, indent=4))
|
||||||
|
|
||||||
for thread in data.children:
|
for thread in data.children:
|
||||||
output_thread(thread, os.path.join(destination, "threads", thread.title))
|
output_thread(thread, os.path.join(destination, "threads", __sanitize_title(thread.title)))
|
||||||
|
|
||||||
def output_thread (data, destination):
|
def output_thread (data, destination):
|
||||||
with open(destination, "w") as out_file:
|
with open(destination, "w") as out_file:
|
||||||
out_file.write(json.dumps(data, default=vars, indent=4))
|
out_file.write(json.dumps(data, default=vars, indent=4))
|
||||||
|
|
||||||
|
def __sanitize_title (title):
|
||||||
|
return title.replace("/", "-").replace(":", "-")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user