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.

34 lines
1.0 KiB

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