[[:en:Template:Did you know/Queue/NextPrep]] contains:
4<noinclude> <!-- There is no Prep 8! --> {{documentation|content=This number indicates the next DYK prep set to move into the queue.}}
</noinclude>
What I want to get is just the "4". Is Page.extract() what I'm looking for? Experimentally, it does what I want, but it's not clear if this is actually the intended use case.
from pywikibot.textlib import removeDisabledParts print(removeDisabledParts(text))
This makes something similar, but just the noinclude tag is not included. Bot if you follow the source from https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.remo..., you can adapt it. Alternatively, you could use re.sub().
Roy Smith roy@panix.com ezt írta (időpont: 2023. febr. 4., Szo, 20:34):
[[:en:Template:Did you know/Queue/NextPrep]] contains:
4<noinclude> <!-- There is no Prep 8! --> {{documentation|content=This number indicates the next DYK prep set to
move into the queue.}}
</noinclude>
What I want to get is just the "4". Is Page.extract() what I'm looking for? Experimentally, it does what I want, but it's not clear if this is actually the intended use case.
pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/me... To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org