aboutsummaryrefslogtreecommitdiff
path: root/devscripts/gh-pages/update-sites.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-08-31 15:05:59 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-08-31 15:18:52 +0200
commit691008087b902fa731a8f4f840c1821c93505840 (patch)
tree5d31ccf97d5af8f4344a0a0c6d711539f84ce3d6 /devscripts/gh-pages/update-sites.py
parent10f5c016ec6262e5d29327e97fe4f3d1127ccdff (diff)
Add an automatic page generator for the supported sites (related #156)
They are listed in the "supportedsites.html" page.
Diffstat (limited to 'devscripts/gh-pages/update-sites.py')
-rwxr-xr-xdevscripts/gh-pages/update-sites.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/devscripts/gh-pages/update-sites.py b/devscripts/gh-pages/update-sites.py
new file mode 100755
index 000000000..fa4bb2beb
--- /dev/null
+++ b/devscripts/gh-pages/update-sites.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import sys
+import os
+import textwrap
+
+# We must be able to import youtube_dl
+sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+
+import youtube_dl
+
+def main():
+ with open('supportedsites.html.in', 'r', encoding='utf-8') as tmplf:
+ template = tmplf.read()
+
+ ie_htmls = []
+ for ie in sorted(youtube_dl.gen_extractors(), key=lambda i: i.IE_NAME):
+ ie_html = '<b>{}</b>'.format(ie.IE_NAME)
+ try:
+ ie_html += ': {}'.format(ie.IE_DESC)
+ except AttributeError:
+ pass
+ if ie.working() == False:
+ ie_html += ' (Currently broken)'
+ ie_htmls.append('<li>{}</li>'.format(ie_html))
+
+ template = template.replace('@SITES@', textwrap.indent('\n'.join(ie_htmls), '\t'))
+
+ with open('supportedsites.html', 'w', encoding='utf-8') as sitesf:
+ sitesf.write(template)
+
+if __name__ == '__main__':
+ main()