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