You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

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