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