@ -2,6 +2,7 @@
# This module generates the listing of supported sites which can be found in
# sites.md. It also organizes all the sites in alphanumeric order
import json
import os
# Read the data.json file
with open ( " sherlock/resources/data.json " , " r " , encoding = " utf-8 " ) as data_file :
@ -14,13 +15,16 @@ social_networks.pop('$schema', None)
# Sort the social networks in alphanumeric order
social_networks : list = sorted ( social_networks . items ( ) )
# Make output dir where the site list will be written
os . mkdir ( " output " )
# Write the list of supported sites to sites.md
with open ( " ../sites.md " , " w " ) as site_file :
site_file . write ( f " ## List Of Supported Sites ( { len ( social_networks ) } Sites In Total!) \n " )
with open ( " output/sites.mdx " , " w " ) as site_file :
site_file . write ( f " ---\n title: ' List of supported sites ' \n sidebarTitle: ' Supported sites ' \n icon: ' globe ' \n description: ' Sherlock currently supports **400+** sites ' \n --- \n \n " )
for social_network , info in social_networks :
url_main = info [ " urlMain " ]
is_nsfw = " **(NSFW)** " if info . get ( " isNSFW " ) else " "
site_file . write ( f " 1. ![](https://www.google.com/s2/favicons?domain={ url_main } ) [{ social_network } ]( { url_main } ) { is_nsfw } \n " )
site_file . write ( f " 1. [{ social_network } ]( { url_main } ) { is_nsfw } \n " )
# Overwrite the data.json file with sorted data
with open ( " sherlock/resources/data.json " , " w " ) as data_file :
@ -29,3 +33,4 @@ with open("sherlock/resources/data.json", "w") as data_file:
data_file . write ( " \n " )
print ( " Finished updating supported site listing! " )