Manual:Pywikibot/imageuncat.py

From mediawiki.org
This page is a translated version of the page Manual:Pywikibot/imageuncat.py and the translation is 25% complete.

imageuncat.py is a Pywikibot script used to add uncat template to images without categories at Commons.

See imagerecat to add these images to categories.

This script is working on the given site, so if the Commons should be handled, the site Commons should be given and not a Wikipedia or similar.

パラメーター

パラメーター説明
-yesterday Go through all uploads from yesterday
-recentchanges Go through the changes made between 120 minutes and 70 minutes ago. (This overrides the '-recentchanges' default generator)

All command line arguments for pagegenerators may also be used.


Generators and filters available

ジェネレーターのオプション
パラメーター 説明
-cat 特定のカテゴリに属するすべてのページを対象にする。 Argument can also be given as "-cat:categoryname" or as "-cat:categoryname|fromtitle" (using # instead of | is also allowed in this one and the following)
-catr Like -cat, but also recursively includes pages in subcategories, sub-subcategories etc. of the given category. Argument can also be given as "-catr:categoryname" or as "-catr:categoryname|fromtitle".
-subcats 特定のカテゴリに属するすべての下位カテゴリを対象にする。 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 カテゴリに属していないすべてのページを対象にする。
-uncatcat カテゴリ分けされていないすべてのカテゴリを対象にする。
-uncatfiles カテゴリに属していないすべてのファイルを対象にする。
-file Read a list of pages to treat from the named text file. Page titles in the file may be either enclosed with brackets (example: [[Page]]), or be separated by new lines. Argument can also be given as "-file:filename".
-filelinks 特定の画像/メディア ファイルを使用しているすべてのページを対象にする。 Argument can also be given as "-filelinks:filename".
-search すべての名前空間 にわたって MediaWiki の検索で見つかったすべてのページを対象にする。
-logevents 指定された Special:Log にある記事を対象にする。 The value may be a comma separated list of these values:
logevent,username,start,end

or for backward compatibility:

logevent,username,total

To use the default value, use an empty string. You have options for every type of logs given by the log event parameter which could be one of the following:

spamblacklist, titleblacklist, gblblock, renameuser, globalauth, gblrights, gblrename, abusefilter, massmessage, thanks, usermerge, block, protect, rights, delete, upload, move, import, patrol, merge, suppress, tag, managetags, contentmodel, review, stable, timedmediahandler, newusers

It uses the default number of pages 10.

例:

-logevents:move gives pages from move log (usually redirects)
-logevents:delete,,20 gives 20 pages from deletion log
-logevents:protect,Usr gives pages from protect by user Usr
-logevents:patrol,Usr,20 gives 20 patroled pages by Usr
-logevents:upload,,20121231,20100101 gives upload pages in the 2010s, 2011s, and 2012s
-logevents:review,,20121231 gives review pages since the beginning till the 31 Dec 2012
-logevents:review,Usr,20121231 gives review pages by user Usr since the beginning till the 31 Dec 2012
In some cases it must be given as -logevents:"move,Usr,20"
-interwiki 指定されたページと、他の言語の同等のページをすべて対象にする。 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 特定のページからリンクされているすべてのページを対象にする。 Argument can also be given as "-links:linkingpagetitle".
-liverecentchanges Work on pages from the live recent changes feed. If used as -liverecentchanges:x, work on x recent changes.
-imagesused 特定のページに含まれるすべての画像を対象とする。 Can also be given as "-imagesused:linkingpagetitle".
-newimages Work on the most recent new images. If given as -newimages:x, will work on x newest images.
-newpages Work on the most recent new pages. If given as -newpages:x, will work on x newest pages.
-recentchanges Work on the pages with the most recent changes. If given as -recentchanges:x, will work on the x most recently changed pages. If given as -recentchanges:offset,duration it will work on pages changed from 'offset' minutes with 'duration' minutes of timespan.

Examples:
-recentchanges:20 - gives the 20 most recently changed pages
-recentchanges:120,70 - will give pages with 120 offset minutes and 70 minutes of timespan
-recentchanges:visualeditor,10 - gives the 10 most recently changed pages marked with 'visualeditor'
-recentchanges:"mobile edit,60,35" - will retrieve pages marked with 'mobile edit' for the given offset and timespan

rctags are supported, and the rctag must be the very first parameter part.
-unconnectedpages Work on the most recent unconnected pages to the Wikibase repository. Given as -unconnectedpages:x, will work on the x most recent unconnected pages.
-ref 特定のページにリンクしているすべてのページを対象にする。 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. default value is start:!
-prefixindex Work on pages commencing with a common prefix.
-transcludes 特定のテンプレートを使用しているすべてのページを対象にする。 Argument can also be given as "-transcludes:Title".
-unusedfiles どこにも使用されていない画像/メディア ファイルのすべての解説ページを対象にする。 Argument can be given as "-unusedfiles:n" where n is the maximum number of articles to work on.
-lonelypages 他の記事からリンクされていないすべての記事を対象にする。 Argument can be given as "-lonelypages:n" where n is the maximum number of articles to work on.
-unwatched 誰からもウォッチリストに登録されていないすべての記事を対象にする。 Argument can be given as "-unwatched:n" where n is the maximum number of articles to work on.
-property:name Special:PagesWithProp から指定されたプロパティ名を持つすべてのページを対象にする。
-usercontribs 特定の利用者が編集したすべての記事を対象にする。 (Example : -usercontribs:DumZiBoT)
-weblink 指定された URL への外部リンクを含むすべての記事を対象にする。「-weblink:url」として指定されることもある。
-withoutinterwiki 言語間リンクがないすべてのページを対象にする。 Argument can be given as "-withoutinterwiki:n" where n is the total to fetch.
-mysqlquery Takes a Mysql query string like "SELECT page_namespace, page_title, FROM page WHERE page_namespace = 0" and works on the resulting pages. See Manual:Pywikibot/MySQL .
-sparql Takes a SPARQL SELECT query string including ?item and works on the resulting pages.
-sparqlendpoint Specify SPARQL endpoint URL (optional). (Example : -sparqlendpoint:http://myserver.com/sparql)
-searchitem Takes a search string and works on Wikibase pages that contain it. Argument can be given as "-searchitem:text", where text is the string to look for, or "-searchitem:lang:text", where lang is the language to search items in.
-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.
-randomredirect Work on random redirect pages returned by Special:RandomRedirect. Can also be given as "-randomredirect:n" where n is the number of pages to be returned.
-google Google 検索で見つかるすべてのページを対象にする。 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".
-yahoo Yahoo 検索で見つかるすべてのページを対象にする。 Depends on python module pYsearch. See yahoo_appid in config.py for instructions.
-page 単一のページを対象にする。 Argument can also be given as "-page:pagetitle", and supplied multiple times for multiple pages.
-pageid 単一のページ ID を対象にする。 Argument can also be given as "-pageid:pageid1,pageid2,." or "-pageid:'pageid1|pageid2|..'" and supplied multiple times for multiple pages.
-linter lint エラーがあるページを対象にする。 Extension Linter must be available on the site. -linter select all categories. -linter:high, -linter:medium or -linter:low select all categories for that prio. Single categories can be selected with commas as in -linter:cat1,cat2,cat3 Adding '/int' identifies Lint ID to start querying from: e.g. -linter:high/10000 -linter:show just shows available categories.
フィルターのオプション
パラメーター 説明
-catfilter Filter the page generator to only yield pages in the specified category. See -cat generator for argument format.
-grep A regular expression that needs to match the article otherwise the page won't be returned. Multiple -grep:regexpr can be provided and the page will be returned if content is matched by any of the regexpr provided. Case insensitive regular expressions will be used and dot matches any character, including a newline.
-grepnot Like -grep, but return the page only if the regular expression does not match.
-intersect Work on the intersection of all the provided generators.
-limit When used with any other argument -limit:n specifies a set of pages, work on no more than n pages in total.
-namespaces
-namespace
-ns
Filter the page generator to only yield pages in the specified namespaces. Separate multiple namespace numbers or names with commas.

例:

-ns:0,2,4 -ns:Help,MediaWiki

You may use a preleading "not" to exclude the namespace. 例:

-ns:not:2,3 -ns:not:Help,File

If used with -newpages/-random/-randomredirect/-linter generators, -namespace/-ns must be provided before -newpages/-random/-randomredirect/-linter. If used with -recentchanges generator, efficiency is improved if -namespace is provided before -recentchanges.

If used with -start generator, -namespace/-ns shall contain only one value.
-onlyif A claim the page needs to contain, otherwise the item won't be returned. The format is property=value,qualifier=value. Multiple (or none) qualifiers can be passed, separated by commas.

例:
P1=Q2 (property P1 must contain value Q2)
P3=Q4,P5=Q6,P6=Q7 (property P3 with value Q4 and qualifiers: P5 with value Q6 and P6 with value Q7)

Value can be page ID, coordinate in format: latitude,longitude[,precision] (all values are in decimal degrees), year, or plain string. The argument can be provided multiple times and the item page will be returned only if all claims are present. Argument can be also given as "-onlyif:expression".
-onlyifnot A claim the page must not contain, otherwise the item won't be returned. For usage and examples, see -onlyif above.
-ql Filter pages based on page quality. This is only applicable if contentmodel equals 'proofread-page', otherwise has no effects. Valid values are in range 0-4. Multiple values can be comma-separated.
-subpage -subpage:n filters pages to only those that have depth n i.e. a depth of 0 filters out all pages that are subpages, and a depth of 1 filters out all pages that are subpages of subpages.
-titleregex A regular expression that needs to match the article title otherwise the page won't be returned. Multiple -titleregex:regexpr can be provided and the page will be returned if title is matched by any of the regexpr provided. Case insensitive regular expressions will be used and dot matches any character.
-titleregexnot Like -titleregex, but return the page only if the regular expression does not match.


利用できるグローバル引数

以下のオプションを用いることで、user-config.py の設定を上書きすることができます。

グローバル オプション
パラメーター 説明 設定変数名
-dir:パス 既定のディレクトリではなく、PATH で指定されたディレクトリからボットの設定データを読み込みます。  
-config:ファイル The user config filename. Default is user-config.py. user-config.py
-lang:xx user-config.py の設定を上書きする形で、作業するウィキの言語を設定します。xx には設定する適切な言語コードに置き換えてください。 mylang
-family:xyz 作業するウィキのファミリーを設定します。xyz には wikipedia、wiktionary、wikitravel などを指定します。 This will override the configuration in user-config.py. family
-user:xyz 既定の利用者名ではなく、利用者 'xyz' としてログインします。 usernames
-daemonize:xyz 直ちにターミナルへ操作を返し、stdout と stderr をファイル xyz にリダイレクトします。これは stdin からの入力を必要としないボットのみで使用します。  
-help ヘルプ テキストを表示します。  
-log ログファイル (ファイル名は既定で「スクリプト名-bot.log」の形式になります) の出力を有効にします。ログは logs の下位ディレクトリに保存されます。 log
-log:xyz ファイル xyz へのログの出力を有効にします。xyz にはファイル名を指定します。 logfilename
-nolog ログ ファイルの出力を無効にします (既定で有効になっている場合)。  
-maxlag maxlag パラメータの秒数を新しく設定します。 データベース サーバーが遅延している間、ボットの編集を遅らせます。既定値は config.py で設定できます。 maxlag
-putthrottle:n
-pt:n
-put_throttle:n
ページを保存するまでの最小時間(秒)を設定します。 put_throttle
-debug:item
-debug
コンポーネント "item" の拡張デバッグデータをログファイルに出力します。item にはデバッグの対象を指定します。item を指定しない場合、すべてのコンポーネントが対象になります。 debug_log
-verbose
-v
デバッグに役立つ、より詳細なメッセージをコンソールに出力するようにします。 verbose_output
-cosmeticchanges
-cc
config.py あるいは user-config.py での cosmetic_changes 設定を逆にし、無効にします。 その他の設定や制限はそのまま使用されます。 cosmetic_changes
-simulate サーバーへの書き込みを無効にします。 これは、コードのテストやデバッグに有用です (このオプションを使用時、変更される内容は表示されますが、実際に変更されることはありません)。 simulate
-<設定変数>:n 任意の設定変数と数値をオプションとして使用し、それをコマンドラインで変更できるようにします。