From Wikipedia, the free encyclopedia
import sys
import datetime
import urllib.request as request
import re

def update_by_year(year):
    promoted_page_name = 'https://en.wikipedia.org/?title=Wikipedia:Featured_articles_promoted_in_' + str(year) + '&action=raw'
    promoted_page = request.urlopen(promoted_page_name)
    if ((resp_code := promoted_page.getcode()) != 200):
        return (resp_code, promoted_page.msg)

    featured_articles = []
    former_articles = []
    maindate_articles = []
    with open('featureds', 'r') as featureds, open('formers', 'r') as formers, open('maindate.all', 'r') as maindate:
        featured_articles = featureds.readlines()
        former_articles = formers.readlines()
        maindate_articles = maindate.readlines()

    fanom_page = 'FAnoms.' + str(year)
    with open(fanom_page, 'w') as fanom_file:
        for line in promoted_page.readlines():
            line_str = line.decode('utf-8')
            if ('||' in line_str):
                is_former_or_maindate = False
                page_info = line_str[2:].strip().split('||') #start from index 2 to ignore the leading '||'
                article_name = page_info[0].strip().replace('[[', '').replace(']]', '')
                if (article_name in former_articles):
                    is_former_or_maindate = True
                    print ('|| <s>' + page_info[0] + '</s> || ' + page_info[1] + ' || ' + page_info[2], file=fanom_file)
                if (article_name in maindate_articles):
                    is_former_or_maindate = True
                    maindate_info = [info for info in maindate_articles if article_name in info]
                    maindate = maindate_info[0].strip().split('||')[1]
                    print ('|| ' + page_info[0] + ' || ' + maindate + ' || ' + page_info[2], file=fanom_file)
                if (not is_former_or_maindate):
                    print (line_str, file=fanom_file)
            else:
                print (line_str, file=fanom_file)
    fanom_file.close()


if __name__ == '__main__':
    today = datetime.date.today()
    update_by_year(today.year)

From Wikipedia, the free encyclopedia
import sys
import datetime
import urllib.request as request
import re

def update_by_year(year):
    promoted_page_name = 'https://en.wikipedia.org/?title=Wikipedia:Featured_articles_promoted_in_' + str(year) + '&action=raw'
    promoted_page = request.urlopen(promoted_page_name)
    if ((resp_code := promoted_page.getcode()) != 200):
        return (resp_code, promoted_page.msg)

    featured_articles = []
    former_articles = []
    maindate_articles = []
    with open('featureds', 'r') as featureds, open('formers', 'r') as formers, open('maindate.all', 'r') as maindate:
        featured_articles = featureds.readlines()
        former_articles = formers.readlines()
        maindate_articles = maindate.readlines()

    fanom_page = 'FAnoms.' + str(year)
    with open(fanom_page, 'w') as fanom_file:
        for line in promoted_page.readlines():
            line_str = line.decode('utf-8')
            if ('||' in line_str):
                is_former_or_maindate = False
                page_info = line_str[2:].strip().split('||') #start from index 2 to ignore the leading '||'
                article_name = page_info[0].strip().replace('[[', '').replace(']]', '')
                if (article_name in former_articles):
                    is_former_or_maindate = True
                    print ('|| <s>' + page_info[0] + '</s> || ' + page_info[1] + ' || ' + page_info[2], file=fanom_file)
                if (article_name in maindate_articles):
                    is_former_or_maindate = True
                    maindate_info = [info for info in maindate_articles if article_name in info]
                    maindate = maindate_info[0].strip().split('||')[1]
                    print ('|| ' + page_info[0] + ' || ' + maindate + ' || ' + page_info[2], file=fanom_file)
                if (not is_former_or_maindate):
                    print (line_str, file=fanom_file)
            else:
                print (line_str, file=fanom_file)
    fanom_file.close()


if __name__ == '__main__':
    today = datetime.date.today()
    update_by_year(today.year)


Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook