#!/usr/bin/env python
import urllib2
# path to your xenforo threads directory with the trailing slash
xenpath = "http://www.yourforum.com/threads/"
# largest thread id on your forum (find the newest thread and write down the id number, don't simply copy number listed in Forum Statistics)
totalthreads = 529
# path to save the resulting text file
savepath = "C:/Folder Path/Desired File Name.txt"
filehandle = open(savepath, "w")
print "Working..."
for thread in reversed(range(1, totalthreads+1)):
try:
link = xenpath+"a.%s/" % thread
response = urllib2.urlopen(link)
url = response.geturl()
filehandle.write(url+"\n")
except urllib2.HTTPError, error:
if error.code == 404:
print "Thread #", thread, "is a deleted thread."
else:
print "Script has been stopped -", error
raise SystemExit()
filehandle.close()
print "Completed. Results have been saved to", savepath