]> Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/make_supportedsites.py
Update upstream source from tag 'upstream/2018.06.18'
[youtubedl] / devscripts / make_supportedsites.py
1 #!/usr/bin/env python
2 from __future__ import unicode_literals
3
4 import io
5 import optparse
6 import os
7 import sys
8
9
10 # Import youtube_dl
11 ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
12 sys.path.insert(0, ROOT_DIR)
13 import youtube_dl
14
15
16 def main():
17 parser = optparse.OptionParser(usage='%prog OUTFILE.md')
18 options, args = parser.parse_args()
19 if len(args) != 1:
20 parser.error('Expected an output filename')
21
22 outfile, = args
23
24 def gen_ies_md(ies):
25 for ie in ies:
26 ie_md = '**{0}**'.format(ie.IE_NAME)
27 ie_desc = getattr(ie, 'IE_DESC', None)
28 if ie_desc is False:
29 continue
30 if ie_desc is not None:
31 ie_md += ': {0}'.format(ie.IE_DESC)
32 if not ie.working():
33 ie_md += ' (Currently broken)'
34 yield ie_md
35
36 ies = sorted(youtube_dl.gen_extractors(), key=lambda i: i.IE_NAME.lower())
37 out = '# Supported sites\n' + ''.join(
38 ' - ' + md + '\n'
39 for md in gen_ies_md(ies))
40
41 with io.open(outfile, 'w', encoding='utf-8') as outf:
42 outf.write(out)
43
44
45 if __name__ == '__main__':
46 main()