]> Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/gh-pages/update-sites.py
Merge tag 'upstream/2014.10.30'
[youtubedl] / devscripts / gh-pages / update-sites.py
1 #!/usr/bin/env python3
2
3 import sys
4 import os
5 import textwrap
6
7 # We must be able to import youtube_dl
8 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
9
10 import youtube_dl
11
12 def main():
13 with open('supportedsites.html.in', 'r', encoding='utf-8') as tmplf:
14 template = tmplf.read()
15
16 ie_htmls = []
17 for ie in sorted(youtube_dl.gen_extractors(), key=lambda i: i.IE_NAME.lower()):
18 ie_html = '<b>{}</b>'.format(ie.IE_NAME)
19 ie_desc = getattr(ie, 'IE_DESC', None)
20 if ie_desc is False:
21 continue
22 elif ie_desc is not None:
23 ie_html += ': {}'.format(ie.IE_DESC)
24 if ie.working() == False:
25 ie_html += ' (Currently broken)'
26 ie_htmls.append('<li>{}</li>'.format(ie_html))
27
28 template = template.replace('@SITES@', textwrap.indent('\n'.join(ie_htmls), '\t'))
29
30 with open('supportedsites.html', 'w', encoding='utf-8') as sitesf:
31 sitesf.write(template)
32
33 if __name__ == '__main__':
34 main()