Created
December 8, 2022 19:09
-
-
Save Pokechu22/092fde7a3e13c2f872f517ad19334bb0 to your computer and use it in GitHub Desktop.
Revisions
-
Pokechu22 created this gist
Dec 8, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ import sys with open(sys.argv[1]) as fin: lines = fin.readlines() INDEX_URL = sys.argv[2] TITLE_PREFIX = ' <title>' TITLE_SUFFIX = '</title>\n' REV_PREFIX = ' <id>' REV_SUFFIX = '</id>\n' for line in lines: if line.startswith(TITLE_PREFIX): cur_title = line[len(TITLE_PREFIX):-len(TITLE_SUFFIX)].replace(' ', '_') if line.startswith(REV_PREFIX): rev=line[len(REV_PREFIX):-len(REV_SUFFIX)] print(INDEX_URL + '?title=' + cur_title + '&oldid=' + rev) print(INDEX_URL + '?title=' + cur_title + '&action=edit&oldid=' + rev)