Page MenuHomePhabricator

Allow in -weblink to use other protocols than http
Closed, ResolvedPublic

Description

As I understand from the code it's not possible using script argument (like in listpages.py) to fetch other external link than http ones, the default of the generator. https is obviously the most missed one.

pagegenerators.py
def _handle_weblink(self, value):
	"""Handle `-weblink` argument."""
	if not value:
		value = pywikibot.input(
			'Pages with which weblink should be processed?')
	# If url is * we make it None in order to search for every page
	# with any URL.
	if value == '*':
		value = None
	return LinksearchPageGenerator(value, site=self.site)

@deprecated_args(link='url', euprotocol='protocol', step=None)
def LinksearchPageGenerator(url, namespaces=None, total=None, site=None, protocol='http'):
	"""Yield all pages that link to a certain URL, like Special:Linksearch.
	@param url: The URL to search for (without the protocol prefix);
	this may include a '*' as a wildcard, only at the start of the
	hostname
	@type url: str
	@param namespaces: list of namespace numbers to fetch contribs from
	@type namespaces: list of int
	@param total: Maximum number of pages to retrieve in total
	@type total: int
	@param site: Site for generator results.
	@type site: L{pywikibot.site.BaseSite}
	"""
	if site is None:
		site = pywikibot.Site()
	return site.exturlusage(url, namespaces=namespaces, protocol=protocol,
				total=total, content=False)

Event Timeline

Framawiki renamed this task from Allow in -weblink to use other protocols that http to Allow in -weblink to use other protocols than http.Apr 28 2020, 5:48 PM

Change 593055 had a related patch set uploaded (by Framawiki; owner: Framawiki):
[pywikibot/core@master] [FEAT] pagegenerators: handle protocols in -weblink

https://gerrit.wikimedia.org/r/593055

Change 593055 merged by jenkins-bot:
[pywikibot/core@master] [FEAT] pagegenerators: handle protocols in -weblink

https://gerrit.wikimedia.org/r/593055