import pywikibot
from pywikibot import pagegenerators
import re
from IPython import display

site = pywikibot.Site('en', 'wikipedia')
def iter_creations():
    start = '2019-08-01T00:00:00Z'
    namespace = 2
    gen = site.logevents(
        logtype='create', start=start, namespace=namespace,
        end='now', reverse=True)
    return gen

def check_comment(entry):
        comment = entry.comment()
    except pywikibot.exceptions.HiddenKeyError:
        return False
        search = r"\[\[WP:AES\|←]]Created page with '\[http"
        regex = re.compile(search)

        match = re.match(regex, comment) is not None
        return match

def check_newbie(entry):
        username = entry.user()
    except pywikibot.exceptions.HiddenKeyError:
        return False
        user = pywikibot.User(site, username)
        groups = user.groups()

        is_newbie = not 'autoconfirmed' in groups
        return is_newbie

def format_output(entry):
    date = entry.timestamp()
    username = entry.user()
    user = pywikibot.User(site, username)
    user_title = username
    user_link = user.full_url()
    contribs = pywikibot.Page(site, f'Special:Contribs/{username}').full_url()
    page =
    page_title = page.title()
    comment = entry.comment()[12:]
    log = pywikibot.Page(site, f'Special:Log/create/{username})').full_url()
    if not page.exists():
        page_title = '~~' + page_title + '~~'
    if not user.isBlocked():
        user_title = '~~' + user_title + '~~'
    markdown = f'* {date} [{user_title}]({user_link}) ([contribs]({contribs})) created page [{page_title}]({page.full_url()})) ({comment}) ([log]({log}))'
    return markdown
def main():
    for entry in iter_creations():          
        if check_newbie(entry) and check_comment(entry):
            display.display_markdown(format_output(entry), raw=True)

Page creations that begin with an external link, where the page was created in the last month by a currently non-autoconfirmed user

Deleted pages and blocked users are struck. Revdeled usernames or comments are skipped

  • 2019-08-20T03:21:34Z Canhrau (contribs) created page User:Canhrau) (Created page with '[] là một trang Web/Blog cá nhân chia sẻ kiến thức từ cơ bản để chuyên sâu trong lĩnh vực công nghệ má...') (log)
  • 2019-08-28T09:30:49Z (contribs) created page (Created page with '[ Elink] is a content curation and bookmarking application for the web. elink is the fastest way to create email newsletters, fast website conten...') (log)


Copyright 2019 AntiCompositeNumber

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

To fork:

  1. Open the raw page and save it to your computer
  2. Go to your PAWS control panel and sign in using OAUTH
  3. Click Upload and upload the file from step 1
  4. To run, open the notebook and click Cell > Run All