2019-03-01 18:48:22 +01:00
#!/usr/bin/env python3
2020-07-21 00:31:06 +02:00
# -*- coding: utf-8 -*-
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
from generator import download , get_version , write_to_file
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
def process ( url , dst ) :
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
university_list = download ( url ) . json ( )
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
warninglist = {
2020-09-23 21:58:03 +02:00
' type ' : " string " ,
2020-07-21 00:31:06 +02:00
' name ' : " University domains " ,
' matching_attributes ' : [ ' hostname ' , ' domain ' , ' url ' , ' domain|ip ' ] ,
' version ' : get_version ( ) ,
' description ' : " List of University domains from https://raw.githubusercontent.com/Hipo/university-domains-list/master/world_universities_and_domains.json " ,
' list ' : [ ]
}
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
for university in university_list :
for domain in university . get ( ' domains ' ) :
if domain not in warninglist [ ' list ' ] :
warninglist [ ' list ' ] . append ( domain )
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
write_to_file ( warninglist , dst )
2019-03-01 18:48:22 +01:00
2020-07-21 00:31:06 +02:00
if __name__ == ' __main__ ' :
university_url = ' https://raw.githubusercontent.com/Hipo/university-domains-list/master/world_universities_and_domains.json '
university_dst = ' university_domains '
process ( university_url , university_dst )