This should do it. Run this in Python and it will print all of the pages you want to the console.
Code:
keywords = ["your", "keywords", "go", "here"]
oldtext = "<Your template goes here, with %KEY% {everywhere|in any place} you want a keyword>"
import re
import random
def stripspin(phrase):
if(phrase[len(phrase)-1:] == '}'): phrase = phrase[:len(phrase)-1]
if(phrase[:1] == '{'): phrase = phrase[1:]
return phrase
text = oldtext
p = re.compile('{[^{}]*}')
for keyword in keywords:
while re.search(p, text):
instance = re.search(p, text).group(0)
instance = instance.strip('{}')
instance = instance.split('|')
text = p.sub(random.choice(instance), text)
print text.replace("%KEY%", keyword)
text = oldtext
Bookmarks