whoogle-search/opensearch.py

20 lines
646 B
Python
Raw Normal View History

2020-04-12 00:24:00 +03:00
import sys
template_path = './app/static/opensearch.template'
opensearch_path = './app/static/opensearch.xml'
replace_tag = 'SHOOGLE_URL'
if len(sys.argv) != 2:
print('You must provide the url as an argument for this script.')
print('Example: python opensearch.py "https://my-app-1776.herokuapps.com"')
sys.exit(0)
app_url = sys.argv[1].rstrip('/')
2020-04-12 00:24:00 +03:00
opensearch_template = open(template_path, 'r').read()
with open(opensearch_path, 'w') as opensearch_xml:
opensearch_xml.write(opensearch_template.replace(replace_tag, app_url))
opensearch_xml.close()
print('\nDone - you may now set Shoogle as your primary search engine')