Page MenuHomePhabricator

Page(site, title).interwiki() doesn't work
Closed, DeclinedPublic

Description

Author: coet.cawiki

Description:
I observed that Page(site, title).interwiki() doesn't work.
I think it is because DataPage().get()['link'] returns something like {"nowiki":{"name: "Title", "badges": []}}
and it was expected something like {"nowiki": "Title"}

Another bug i observed is that wikidata gives also the Commons link

I have modified the wikipedia.py line 4719

from "links[code]) for code in links]"
to "links[code]['name']) for code in links if "commons" not in code]"

and it works fine but I think that the condition 'if "commons" not in code' is not *always* a good solution.


Version: compat-(1.0)
Severity: major

Details

Reference
bz56734

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:16 AM
bzimport set Reference to bz56734.
bzimport added a subscriber: Unknown Object (????).

coet.cawiki wrote:

I assert that "" is the unique solution and it's right because the last function keep all links related with wikipedias, and doesn't expect a commons link.

getSite(code.replace('wiki','').replace('_', '-'), fam='wikipedia')

if "commons" appears in this function it raise a NoSuchSite error because language family does not exist.

I have evaluate the following results: https://www.wikidata.org/w/api.php?action=query&format=jsonfm&prop=revisions&rvprop=content&titles=Q90&pllimit=max and I watch that commons link and wikivoyage links are included in the content. That means that it's necessary to exclude "commons" and "voyage" links to avoid other raise errors.

So I purpose the following change for the line 4719 of the file wikipedia.py:
links[code]['name']) for code in links if "commons" not in code and "voyage" not in code]

coet.cawiki wrote:

I meant: I assert that "links[code]['name']) for code in links if "commons" not in code]"

I made a dirty hack weeks ago in https://gerrit.wikimedia.org/r/#/c/85839/ as I found that problem. Maybe we should solve it in a generic way to filter the site in the interlanguage method but keep it for some interwiki links.

Aklapper triaged this task as Lowest priority.Jun 5 2015, 1:41 PM
Aklapper subscribed.

Pywikibot has two versions: Compat and Core. This task was filed about the older version, called Pywikibot-compat, which is not under active development anymore. Hence I'm lowering the priority of this task to reflect the reality. Unfortunately, the Pywikibot team does not have the manpower to retest every single bug report / feature request against the (maintained) Pywikibot code base. Furthermore, the code base of Pywikibot-Compat has changed a lot compared to the code base of Pywikibot-Core so there is a chance that the problem described in this task might not exist anymore. Please help: Unfortunately manpower is limited and does not allow testing every single reported task again. If you have time and interest in Pywikibot, please upgrade to Pywikibot-Core and add a comment to this task if the problem in this task still happens in Pywikibot-Core (or directly edit the task by removing the Pywikibot-compat project and adding the Pywikibot project to this task). To learn more about Pywikibot and to get involved in its development, please check out https://www.mediawiki.org/wiki/Manual:Pywikibot/Development Thank you for your understanding.

Xqt subscribed.

compat branch is closed