Bináris,

thanks for your help - but to do so, I suppose have to translate the "mw" prefix into "mediawiki" first. That's the crucial point, since the code should be able to handle any valid interwiki prefix. there a way to do this?

In the meanwhile, I've tried to write a small API query:

def translate_interwiki(prefix:str, site:pywikibot.Site) -> str:
    r = pywikibot.data.api.Request(parameters={'action': 'query', 'meta': 'siteinfo', 'siprop': 'interwikimap'})
    data = r.submit()
    iwm = data['query']['interwikimap']
    entry = next((item for item in iwm if item["prefix"] == prefix), False)
    return entry['url']

But I'm not sure if there's already something built into pwb?

Cheers
Florian

Am 23.08.2024 um 12:41 schrieb Bináris:
First create a Page object, where 'mediawiki' is the site, and 'Manual:Pywikibot' is the title.
You will get the desired URL with this method:
https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html#page.BasePage.full_url