2021-06-03 05:43:42 -04:00
|
|
|
#!/usr/bin/env python3
|
2014-12-30 13:35:35 -05:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import io
|
|
|
|
import optparse
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
2021-02-24 13:45:56 -05:00
|
|
|
# Import yt_dlp
|
2014-12-30 13:35:35 -05:00
|
|
|
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
|
2015-09-15 09:30:24 -04:00
|
|
|
sys.path.insert(0, ROOT_DIR)
|
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:
|
2015-01-07 10:09:43 -05:00
|
|
|
ie_md = '**{0}**'.format(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:
|
2015-01-07 10:09:43 -05:00
|
|
|
ie_md += ': {0}'.format(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))
|
|
|
|
|
|
|
|
with io.open(outfile, 'w', encoding='utf-8') as outf:
|
|
|
|
outf.write(out)
|
|
|
|
|
2016-11-17 06:42:56 -05:00
|
|
|
|
2014-12-30 13:35:35 -05:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|