]>
Commit | Line | Data |
---|---|---|
cc52de43 | 1 | #!/usr/bin/env python3 |
416c7fcb PH |
2 | import optparse |
3 | import os | |
4 | import sys | |
5 | ||
0f06bcd7 | 6 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
7 | ||
7a5c1cfe | 8 | import yt_dlp |
416c7fcb PH |
9 | |
10 | ||
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 | ||
17 | outfile, = args | |
18 | ||
19 | def gen_ies_md(ies): | |
20 | for ie in ies: | |
86e5f3ed | 21 | ie_md = f'**{ie.IE_NAME}**' |
231025c4 | 22 | if ie.IE_DESC is False: |
416c7fcb | 23 | continue |
231025c4 | 24 | if ie.IE_DESC is not None: |
86e5f3ed | 25 | ie_md += f': {ie.IE_DESC}' |
96565c7e | 26 | search_key = getattr(ie, 'SEARCH_KEY', None) |
27 | if search_key is not None: | |
28 | ie_md += f'; "{ie.SEARCH_KEY}:" prefix' | |
416c7fcb PH |
29 | if not ie.working(): |
30 | ie_md += ' (Currently broken)' | |
31 | yield ie_md | |
32 | ||
7a5c1cfe | 33 | ies = sorted(yt_dlp.gen_extractors(), key=lambda i: i.IE_NAME.lower()) |
416c7fcb PH |
34 | out = '# Supported sites\n' + ''.join( |
35 | ' - ' + md + '\n' | |
36 | for md in gen_ies_md(ies)) | |
37 | ||
86e5f3ed | 38 | with open(outfile, 'w', encoding='utf-8') as outf: |
416c7fcb PH |
39 | outf.write(out) |
40 | ||
582be358 | 41 | |
416c7fcb PH |
42 | if __name__ == '__main__': |
43 | main() |