2021-06-03 05:43:42 -04:00
|
|
|
#!/usr/bin/env python3
|
2014-12-30 13:35:35 -05:00
|
|
|
import optparse
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2022-05-09 07:54:28 -04:00
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
2021-02-24 13:45:56 -05:00
|
|
|
import yt_dlp
|
2014-12-30 13:35:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = optparse.OptionParser(usage='%prog OUTFILE.md')
|
|
|
|
options, args = parser.parse_args()
|
|
|
|
if len(args) != 1:
|
|
|
|
parser.error('Expected an output filename')
|
|
|
|
|
|
|
|
outfile, = args
|
|
|
|
|
|
|
|
def gen_ies_md(ies):
|
|
|
|
for ie in ies:
|
2022-04-11 11:10:28 -04:00
|
|
|
ie_md = f'**{ie.IE_NAME}**'
|
2022-03-23 21:23:11 -04:00
|
|
|
if ie.IE_DESC is False:
|
2014-12-30 13:35:35 -05:00
|
|
|
continue
|
2022-03-23 21:23:11 -04:00
|
|
|
if ie.IE_DESC is not None:
|
2022-04-11 11:10:28 -04:00
|
|
|
ie_md += f': {ie.IE_DESC}'
|
2021-10-23 10:29:52 -04:00
|
|
|
search_key = getattr(ie, 'SEARCH_KEY', None)
|
|
|
|
if search_key is not None:
|
|
|
|
ie_md += f'; "{ie.SEARCH_KEY}:" prefix'
|
2014-12-30 13:35:35 -05:00
|
|
|
if not ie.working():
|
|
|
|
ie_md += ' (Currently broken)'
|
|
|
|
yield ie_md
|
|
|
|
|
2021-02-24 13:45:56 -05:00
|
|
|
ies = sorted(yt_dlp.gen_extractors(), key=lambda i: i.IE_NAME.lower())
|
2014-12-30 13:35:35 -05:00
|
|
|
out = '# Supported sites\n' + ''.join(
|
|
|
|
' - ' + md + '\n'
|
|
|
|
for md in gen_ies_md(ies))
|
|
|
|
|
2022-04-11 11:10:28 -04:00
|
|
|
with open(outfile, 'w', encoding='utf-8') as outf:
|
2014-12-30 13:35:35 -05:00
|
|
|
outf.write(out)
|
|
|
|
|
2016-11-17 06:42:56 -05:00
|
|
|
|
2014-12-30 13:35:35 -05:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|