logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

make_supportedsites.py (1121B)


  1. #!/usr/bin/env python
  2. from __future__ import unicode_literals
  3. import optparse
  4. import os.path
  5. import sys
  6. # Import youtube_dl
  7. dirn = os.path.dirname
  8. sys.path.insert(0, dirn(dirn(os.path.abspath(__file__))))
  9. import youtube_dl
  10. from utils import write_file
  11. def main():
  12. parser = optparse.OptionParser(usage='%prog OUTFILE.md')
  13. options, args = parser.parse_args()
  14. if len(args) != 1:
  15. parser.error('Expected an output filename')
  16. outfile, = args
  17. def gen_ies_md(ies):
  18. for ie in ies:
  19. ie_md = '**{0}**'.format(ie.IE_NAME)
  20. ie_desc = getattr(ie, 'IE_DESC', None)
  21. if ie_desc is False:
  22. continue
  23. if ie_desc is not None:
  24. ie_md += ': {0}'.format(ie.IE_DESC)
  25. if not ie.working():
  26. ie_md += ' (Currently broken)'
  27. yield ie_md
  28. ies = sorted(youtube_dl.gen_extractors(), key=lambda i: i.IE_NAME.lower())
  29. out = '# Supported sites\n' + ''.join(
  30. ' - ' + md + '\n'
  31. for md in gen_ies_md(ies))
  32. write_file(outfile, out)
  33. if __name__ == '__main__':
  34. main()