Manual:Pywikibot/pagegenerators.py/fr

pagegenerators.py peut générer une liste de pages.

Ce module offre une grande variété de générateurs de pages. Un générateur est un object iterable (dans le langage http://www.python.org/dev/peps/pep-0255/) qui itère sur un ensemble d'objet "pages" que les autres scripts peuvent ensuite utiliser

Utilisation en ligne de commande
La version de la branche compatpeut être utilisée directement, à des fins de tests.

Exemple:

Cet appel retourne, sur la sortie standard, une liste de page contenant foobar, comme retourne la recherche de MediaWiki.

La version core ne peut être utilisé que par l'intermédiaire du scripts (ou autre), pas directement.

Exemple:

Cet commande affiche sur la sortie standard la liste des pages retournée par la recherche foobar du moteur de recherche de mediawiki.

Paramètres
Ces paramètres sont destinés à spécifier les titres des pages à afficher:


 * -cat: L'ensemble des pages catégorisées dans une catégorie donnée. L'argument peut aussi être passé comme "-cat:nomdecatégorie" ou comme "-cat:nomdecatégorie|àpartirdutitre".
 * -catr: De même que -cat, mais inclus récursivement les pages des sous catégories de la catégorie de départ. synonymes "-catr:nomdecat" or as "-catr:nomdecat|apartirdutitre".
 * -subcats: Work on all subcategories of a specific category. Argument can also be given as "-subcats:categoryname" or as "-subcats:categoryname|fromtitle".
 * -subcatsr: Like -subcats, but also includes sub-subcategories etc. of the given category. Argument can also be given as "-subcatsr:categoryname" or as "-subcatsr:categoryname|fromtitle".
 * -uncat: Travailler sur toutes les pages non catégorisées.
 * -uncatcat: Travaillez sur les catégories non catégorisées.
 * -uncatfiles: Travailler sur tous les fichiers non catégorisés.
 * -file: Lire une liste des pages à traiter à partir d'un fichier texte nommé. Les titres doivent être encadrés par  ou séparés par des retours chariots. Les arguments peuvent alternativement donné par l'option "-file:nomdefichier".
 * -filelinks: Travailler sur les pages qui utilisent un certain fichier/image. L'argument est spécifiable par l'option "-filelinks:nomdefichier".
 * -yahoo: Work on all pages that are found in a Yahoo search. Depends on python module pYsearch. See yahoo_appid in config.py for instructions.
 * -search: Work on all pages that are found in a MediaWiki search across all namespaces.
 * -google: Work on all pages that are found in a Google search. You need a Google Web API license key. Note that Google doesn't give out license keys anymore. See google_key in config.py for instructions. Argument can also be given as "-google:searchstring".
 * -namespace: Filters the page generator to only yield pages in the specified namespaces. Separate multiple namespace numbers with commas.
 * -interwiki: Work on the given page and all equivalent pages in other languages. This can, for example, be used to fight multi-site spamming. Attention: this will cause the bot to modify pages on several wiki sites, this is not well tested, so check your edits!
 * -links: Work on all pages that are linked from a certain page. Argument can also be given as "-links:linkingpagetitle".
 * -new: Work on the 60 newest pages. If given as -new:x, will work on the x newest pages.
 * -imagelinks: Work on all images that are linked from a certain page. Argument can also be given as "-imagelinks:linkingpagetitle".
 * -newimages: Work on the 100 newest images. If given as -newimages:x, will work on the x newest images.
 * -ref: Work on all pages that link to a certain page. Argument can also be given as "-ref:referredpagetitle".
 * -start: Specifies that the robot should go alphabetically through all pages on the home wiki, starting at the named page. Argument can also be given as "-start:pagetitle". You can also include a namespace. For example, "-start:Template:!" will make the bot work on all pages in the template namespace.
 * -prefixindex: Work on pages commencing with a common prefix.
 * -titleregex: Work on titles that match the given regular expression.
 * -transcludes: Work on all pages that use a certain template. Argument can also be given as "-transcludes:Title" (without Template:prefix).
 * -unusedfiles: Work on all description pages of images/media files that are not used anywhere. Argument can be given as "-unusedfiles:n" where n is the maximum number of articles to work on.
 * -unwatched: Work on all articles that are not watched by anyone. Argument can be given as "-unwatched:n" where n is the maximum number of articles to work on.
 * -usercontribs: Work on all articles that were edited by a certain user. Exemple: -usercontribs:DumZiBoT
 * -weblink: Work on all articles that contain an external link to a given URL; may be given as "-weblink:url"
 * -withoutinterwiki: Work on all pages that don't have interlanguage links. Argument can be given as "-withoutinterwiki:n" where n is some number (??).
 * -random: Work on random pages returned by Special:Random. Can also be given as "-random:n" where n is the number of pages to be returned, else 10 pages are returned.
 * -randomredirect: Work on random redirect target pages returned by Special:Randomredirect. Can also be given as "-randomredirect:n" where n is the number of pages to be returned, else 10 pages are returned.
 * -gorandom: Specifies that the robot should starting at the random pages returned by Special:Random.
 * -recentchanges: Work on new and edited pages returned by Special:Recentchanges. Can also be given as "-recentchanges:n" where n is the number of pages to be returned, else 100 pages are returned.
 * -redirectonly: Work on redirect pages only, not their target pages. The robot goes alphabetically through all redirect pages on the wiki, starting at the named page. The argument can also be given as "-redirectonly:pagetitle". You can also include a namespace. For example, "-redirectonly:Template:!" will make the bot work on all redirect pages in the template namespace.

Appels depuis un autre programme
Récupérateur de Catégories:

Explorateur de sous-catégorie:

requête MySQL:

Veuillez lire le contenu du fichier pour plus d'informations.

recommandation Unicode
The following code returns KeyError: 'query' because of the special character:

If searching in user and mediawiki namespaces, it would look like

Consequently, an encoding conversion is needed: