2021-06-03 09:43:42 +00:00
|
|
|
#!/usr/bin/env python3
|
2014-12-30 18:35:35 +00:00
|
|
|
import optparse
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2021-02-24 18:45:56 +00:00
|
|
|
# Import yt_dlp
|
2014-12-30 18:35:35 +00:00
|
|
|
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
|
2015-09-15 13:30:24 +00:00
|
|
|
sys.path.insert(0, ROOT_DIR)
|
2021-02-24 18:45:56 +00:00
|
|
|
import yt_dlp
|
2014-12-30 18:35:35 +00: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 15:10:28 +00:00
|
|
|
ie_md = f'**{ie.IE_NAME}**'
|
2022-03-24 01:23:11 +00:00
|
|
|
if ie.IE_DESC is False:
|
2014-12-30 18:35:35 +00:00
|
|
|
continue
|
2022-03-24 01:23:11 +00:00
|
|
|
if ie.IE_DESC is not None:
|
2022-04-11 15:10:28 +00:00
|
|
|
ie_md += f': {ie.IE_DESC}'
|
2021-10-23 14:29:52 +00:00
|
|
|
search_key = getattr(ie, 'SEARCH_KEY', None)
|
|
|
|
if search_key is not None:
|
|
|
|
ie_md += f'; "{ie.SEARCH_KEY}:" prefix'
|
2014-12-30 18:35:35 +00:00
|
|
|
if not ie.working():
|
|
|
|
ie_md += ' (Currently broken)'
|
|
|
|
yield ie_md
|
|
|
|
|
2021-02-24 18:45:56 +00:00
|
|
|
ies = sorted(yt_dlp.gen_extractors(), key=lambda i: i.IE_NAME.lower())
|
2014-12-30 18:35:35 +00:00
|
|
|
out = '# Supported sites\n' + ''.join(
|
|
|
|
' - ' + md + '\n'
|
|
|
|
for md in gen_ies_md(ies))
|
|
|
|
|
2022-04-11 15:10:28 +00:00
|
|
|
with open(outfile, 'w', encoding='utf-8') as outf:
|
2014-12-30 18:35:35 +00:00
|
|
|
outf.write(out)
|
|
|
|
|
2016-11-17 11:42:56 +00:00
|
|
|
|
2014-12-30 18:35:35 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|