aboutsummaryrefslogtreecommitdiff
path: root/devscripts/gh-pages/update-sites.py
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-07-25 00:22:54 +0100
committerdirkf <fieldhouse@gmx.net>2023-07-25 13:19:43 +0100
commitb87018122995acb7e6a1be3f2464605259b93611 (patch)
tree11f47d8a9d8e32e04cf5eca2fa9c82448fff49e9 /devscripts/gh-pages/update-sites.py
parenta25e9f3c84a34d43f78a4e5a6f6c2e98e2a0ade3 (diff)
downloadyoutube-dl-b87018122995acb7e6a1be3f2464605259b93611.tar.xz
[build] Extend use of `devscripts/utils`
Diffstat (limited to 'devscripts/gh-pages/update-sites.py')
-rwxr-xr-xdevscripts/gh-pages/update-sites.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/devscripts/gh-pages/update-sites.py b/devscripts/gh-pages/update-sites.py
index 531c93c70..06a8a474c 100755
--- a/devscripts/gh-pages/update-sites.py
+++ b/devscripts/gh-pages/update-sites.py
@@ -5,15 +5,17 @@ import sys
import os
import textwrap
+dirn = os.path.dirname
+
# We must be able to import youtube_dl
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+sys.path.insert(0, dirn(dirn(dirn(os.path.abspath(__file__)))))
import youtube_dl
+from devscripts.utils import read_file, write_file
def main():
- with open('supportedsites.html.in', 'r', encoding='utf-8') as tmplf:
- template = tmplf.read()
+ template = read_file('supportedsites.html.in')
ie_htmls = []
for ie in youtube_dl.list_extractors(age_limit=None):
@@ -29,8 +31,7 @@ def main():
template = template.replace('@SITES@', textwrap.indent('\n'.join(ie_htmls), '\t'))
- with open('supportedsites.html', 'w', encoding='utf-8') as sitesf:
- sitesf.write(template)
+ write_file('supportedsites.html', template)
if __name__ == '__main__':