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.

33 lines
958 B

  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. try:
  15. ie_html += ': {}'.format(ie.IE_DESC)
  16. except AttributeError:
  17. pass
  18. if ie.working() == False:
  19. ie_html += ' (Currently broken)'
  20. ie_htmls.append('<li>{}</li>'.format(ie_html))
  21. template = template.replace('@SITES@', textwrap.indent('\n'.join(ie_htmls), '\t'))
  22. with open('supportedsites.html', 'w', encoding='utf-8') as sitesf:
  23. sitesf.write(template)
  24. if __name__ == '__main__':
  25. main()