Page MenuHomePhabricator

Find links to non-existing pages
Closed, InvalidPublic

Description

I wanted to modify pages that linked to a deleted image. Command:
replace.py -links
Links from which page should be processed? Fájl:PEGY22LOGO.jpg
etc.
Error:
NoPage: (wikipedia:hu, u'[[hu:F\xe1jl:PEGY22LOGO.jpg]]', 'Page does not exist.')
(wikipedia:hu, u'[[hu:F\xe1jl:PEGY22LOGO.jpg]]', 'Page does not exist.')

Well, page may not exist, but the task is still valid.
Tested in compat. I don't know how core reacts.

Event Timeline

binbot raised the priority of this task from to Medium.
binbot updated the task description. (Show Details)
binbot subscribed.

use -ref to get references to that (non existent) page. -links indicates links from that page to others, which indeed is not be able.

core doesn't fail for both. Try
pwb.py listpages -ref:"non existant page"

or

pwb.py listpages -links:"non existant page"

Xqt lowered the priority of this task from Medium to Lowest.Jan 30 2016, 6:58 PM
Xqt added a project: Pywikibot-compat.

Compat is always lowest from developers pov

Sorry, you are right, I used the wrong option.
However, after undeleting page it listed tha other pages which refer to the deleted one.

I've checked it on compat too:

>>> import wikipedia as py
>>> s = py.getSite()
>>> p = py.Page(s, 'Non existent page on de-wiki')
>>> list(p.getReferences())
Getting references to [[Non existent page on de-wiki]] via API...
[]
>>> list(p.linkedPages())

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    list(p.linkedPages())
  File "wikipedia.py", line 2996, in linkedPages
    thistxt = removeLanguageLinks(self.get(get_redirect=True),
  File "wikipedia.py", line 769, in get
    expandtemplates=expandtemplates)
  File "wikipedia.py", line 851, in _getEditPage
    raise NoPage(self.site(), unicode(self), "Page does not exist.")
NoPage: (wikipedia:de, u'[[de:Non existent page on de-wiki]]', 'Page does not exist.')
>>>

this indicates it does not fail for references but it fails for links which is right for an non-existant Page.
On the other hand core just gives an empty generator:

>>> import pwb, pywikibot as py
>>> s = py.Site()
>>> p = py.Page(s, 'Non existing page on de-wiki')
>>> p.exists()
False
>>> list(p.backlinks())
[]
>>> list(p.embeddedin())
[]
>>> list(p.linkedPages())
[]
>>>
Xqt claimed this task.

works for me.