사용자:WonYong/category.py

위키백과 ― 우리 모두의 백과사전.

분류를 조작할 때 쓰는 pywikipedia 스크립트입니다.

(경고. Python 2.4 버전이 필요합니다.)

문법:

python category.py [global-arguments] action [-option]

"action" 인자로서는 다음 중 하나를 사용합니다.

* add      - mass-add a category to a list of pages
* remove   - remove category tag from all pages in a category
* move     - move all pages in a category to another category
* tidy     - tidy up a category by moving its articles into subcategories
* tree     - show a tree of subcategories of a given category
* listify  - make a list of all of the articles that are in a category


"option" 인자로서는 다음을 사용합니다.:

* -person     - sort persons by their last name (for action 'add')
* -rebuild    - reset the database
* -from:      - The category to move from (for the move option)
                Also, the category to remove from in the remove option
                Also, the category to make a list of in the listify option
* -to:        - The category to move to (for the move option)
              - Also, the name of the list to make in the listify option
        NOTE: If the category names have spaces in them you may need to use a
        special syntax in your shell so that the names aren't treated as separate
        parameters.  For instance, in BASH, use single quotes, e.g. -from:'Polar bears'
* -batch      - Don't prompt to delete emptied categories (do it automatically).
* -summary:   - Pick a custom edit summary for the bot.
* -inplace    - Use this flag to change categories in place rather than
                rearranging them.
* -delsum     - An option for remove, this specifies to use the custom edit
                summary as the deletion reason (rather than a canned deletion reason)
* -overwrite  - An option for listify, this overwrites the current page with the
                list even if something is already there.
* -showimages - An option for listify, this displays images rather than linking them
                in the list.
* -talkpages  - An option for listify, this outputs the links to talk pages of the
                pages to be listified in addition to the pages themselves.
* -recurse    - Recurse through all subcategories of categories.
* -match      - Only work on pages whose titles match the given regex (for move and remove actions).

"tidy"와 "tree"라는 action을 사용하실 경우, 봇(bot)은 분류 구조(category structure)를 로컬 파일 "category.dump"에 저장할 것입니다. 이렇게 함으로써 시간을 아끼고 서버 부하를 줄여 줍니다. 하지만 이 덤프를 나중에 또 다시 사용하려고 할 경우에는 이 덤프가 최근 것으로 갱신되지 않은 것이 되게 됩니다. 이 때에는 "-rebuild" 옵션을 부여해 주십시오.

만약 기존의 분류에다가 다른 분류 하나를 추가하시고 싶은 경우 다음과 같이 사용하십시오:

category.py move

기존 분류를 입력하라고 할 것입니다.

OldCategoryname

"분류:" 접두어 없이 분류를 입력하십시오.

새로운 분류를 입력하라고 할 것입니다.

NewCategoryName