Пример #1
0
            data_dict['source'] = page_name
        data.extend(page_data)

    data.sort(key=lambda x: parse(x['created_time']), reverse=True)
    return data


if __name__ == "__main__":
    # Great thanks to https://gist.github.com/abelsonlive/4212647
    news_pages = json.load(open("./pages.json"))
    # for_later = ['Cultural-IIT-Kharagpur']

    data = get_aggregated_feed(news_pages)
    data = remove_duplicates(data)
    data = prettify_date(data)

    json.dump(data, open('docs/feed.json', 'w'))
    write_html(data, 'docs/index.html')

    localtime = str(time.asctime(time.localtime(time.time())))
    stamp = "            <font size=2 color=\"white\"><div align=\"right\"><b>Last updated: " + localtime + " IST</b></div></font>\n"
    fn = open("docs/index.html", "r+")
    fo = open("docs/indext.html", "w")
    while (True):
        abc = fn.readline()
        fo.write(abc)
        if not abc: break
        if (abc[:30] == "            <!Time stamp here>"): fo.write(stamp)
fn.close()
fo.close()
os.system("mv docs/indext.html docs/index.html")
Пример #2
0
			('Kharagpur Data Analytics Group','kgpdag'), ('Autonomous Ground Vehicle','agvkgp'),
			('Aerial Robotics Kharagpur','aerialroboticskgp'),('TeamKART','TeamKART'),('Debating Society','kgpdebsoc'),
			('Technology Literary Society','tlsiitkgp'),('AIESEC','aieseciitkgp'),('Student Welfare Group','SWGIITKGP'),
			('The KGPian Game Theory Society','The.KGTS'),('Electric Vehicle Group','EVPIITKGP'),('Business Club','bclubkgp'),
			('Communiqué','communique.iitkgp'),('International Relations Cell','IRCIITKGP'),
			('Quiz Club','iitkgp.quizclub'),('Branding And Relations Cell','barciitkgp'),('Alumni Cell','iitkgp.alumnicell'),
			('Entrepreneurship Cell','ecell.iitkgp'),('Gopali Youth Welfare Society','gyws.iitkgp'),
			('Kshitij','ktj.iitkgp'),('Spring Fest','springfest.iitkgp'),('CodeClub','CodeClub.IITKGP'),('ProDex','prodex.iitkgp'),
			('Director IIT Kharagpur','director.iitkgp')]
	for_later = ['Cultural-IIT-Kharagpur']

	data = get_aggregated_feed(news_pages)
	data = remove_duplicates(data)
	data = prettify_date(data)

	json.dump(data, open('docs/feed.json', 'w'))
	write_html(data, 'docs/index.html')
	tz = pytz.timezone('Asia/Kolkata')
	now =  datetime.now(tz)
	minutes = now.minute
	if (len(str(minutes))==1):
		text = "Last updated: "+str(now.day)+"-"+str(now.month)+"-"+str(now.year)+", "+str(now.hour)+":0"+str(minutes)+" IST"
	else:
		text = "Last updated: "+str(now.day)+"-"+str(now.month)+"-"+str(now.year)+", "+str(now.hour)+":"+str(minutes)+" IST"
	fn=open("docs/index.html","r")
	fo=open("docs/indext.html","w")
	all_text = fn.read()
	all_text = all_text.replace(' <!-- Time stamp here -->',text)
	fo.write(all_text)
	os.system("mv docs/indext.html docs/index.html")