2018-12-30 17:50:10 +00:00
|
|
|
"""Sherlock: Supported Site Listing
|
2020-08-07 19:55:33 +00:00
|
|
|
This module generates the listing of supported sites
|
|
|
|
which can be found in sites.md
|
|
|
|
It also organizes all the sites in alphanumeric order
|
2018-12-30 17:50:10 +00:00
|
|
|
"""
|
2018-12-29 23:16:43 +00:00
|
|
|
import json
|
2019-01-27 09:31:55 +00:00
|
|
|
|
|
|
|
pool = list()
|
|
|
|
|
2019-10-27 03:42:03 +00:00
|
|
|
with open("sherlock/resources/data.json", "r", encoding="utf-8") as data_file:
|
2019-03-09 11:33:42 +00:00
|
|
|
data = json.load(data_file)
|
2018-12-29 23:16:43 +00:00
|
|
|
|
2019-01-24 11:01:34 +00:00
|
|
|
with open("sites.md", "w") as site_file:
|
2019-03-09 11:33:42 +00:00
|
|
|
data_length = len(data)
|
|
|
|
site_file.write(f'## List Of Supported Sites ({data_length} Sites In Total!)\n')
|
2019-01-24 11:01:34 +00:00
|
|
|
|
2020-08-07 19:55:33 +00:00
|
|
|
for social_network in data:
|
|
|
|
url_main = data.get(social_network).get("urlMain")
|
|
|
|
pool.append((social_network, url_main))
|
2020-08-07 19:07:20 +00:00
|
|
|
|
2020-08-07 19:55:33 +00:00
|
|
|
for social_network, url_main in pool:
|
2020-12-19 10:27:23 +00:00
|
|
|
site_file.write(f'1. [{social_network}]({url_main})\n')
|
2020-08-07 19:55:33 +00:00
|
|
|
|
2019-01-23 14:14:37 +00:00
|
|
|
sorted_json_data = json.dumps(data, indent=2, sort_keys=True)
|
|
|
|
|
2020-05-09 04:39:41 +00:00
|
|
|
with open("sherlock/resources/data.json", "w") as data_file:
|
2019-03-09 11:33:42 +00:00
|
|
|
data_file.write(sorted_json_data)
|
2019-01-23 14:14:37 +00:00
|
|
|
|
2020-08-07 19:55:33 +00:00
|
|
|
print("Finished updating supported site listing!")
|