]> jfr.im git - yt-dlp.git/blame - devscripts/make_supportedsites.py
[docs] Improve manpage format (#2003)
[yt-dlp.git] / devscripts / make_supportedsites.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
416c7fcb
PH
2from __future__ import unicode_literals
3
4import io
5import optparse
6import os
7import sys
8
9
7a5c1cfe 10# Import yt_dlp
416c7fcb 11ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
95240b80 12sys.path.insert(0, ROOT_DIR)
7a5c1cfe 13import yt_dlp
416c7fcb
PH
14
15
16def 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:
c5d666d3 26 ie_md = '**{0}**'.format(ie.IE_NAME)
416c7fcb
PH
27 ie_desc = getattr(ie, 'IE_DESC', None)
28 if ie_desc is False:
29 continue
30 if ie_desc is not None:
c5d666d3 31 ie_md += ': {0}'.format(ie.IE_DESC)
96565c7e 32 search_key = getattr(ie, 'SEARCH_KEY', None)
33 if search_key is not None:
34 ie_md += f'; "{ie.SEARCH_KEY}:" prefix'
416c7fcb
PH
35 if not ie.working():
36 ie_md += ' (Currently broken)'
37 yield ie_md
38
7a5c1cfe 39 ies = sorted(yt_dlp.gen_extractors(), key=lambda i: i.IE_NAME.lower())
416c7fcb
PH
40 out = '# Supported sites\n' + ''.join(
41 ' - ' + md + '\n'
42 for md in gen_ies_md(ies))
43
44 with io.open(outfile, 'w', encoding='utf-8') as outf:
45 outf.write(out)
46
582be358 47
416c7fcb
PH
48if __name__ == '__main__':
49 main()