]> jfr.im git - yt-dlp.git/blame - devscripts/make_contributing.py
[ie/youtube] Fix comments extraction (#9775)
[yt-dlp.git] / devscripts / make_contributing.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
54007a45 2
ccbfaa83 3import optparse
8c6f4daa 4import re
e56190b3
PH
5
6
7def main():
8c6f4daa 8 return # This is unused in yt-dlp
9
ccbfaa83
PH
10 parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
11 options, args = parser.parse_args()
12 if len(args) != 2:
13 parser.error('Expected an input and an output filename')
139cb942 14
8c6f4daa 15 infile, outfile = args
ccbfaa83 16
86e5f3ed 17 with open(infile, encoding='utf-8') as inf:
e56190b3
PH
18 readme = inf.read()
19
8c6f4daa 20 bug_text = re.search(
21 r'(?s)#\s*BUGS\s*[^\n]*\s*(.*?)#\s*COPYRIGHT', readme).group(1)
22 dev_text = re.search(
23 r'(?s)(#\s*DEVELOPER INSTRUCTIONS.*?)#\s*EMBEDDING yt-dlp', readme).group(1)
e56190b3
PH
24
25 out = bug_text + dev_text
26
86e5f3ed 27 with open(outfile, 'w', encoding='utf-8') as outf:
8c6f4daa 28 outf.write(out)
29
582be358 30
e56190b3
PH
31if __name__ == '__main__':
32 main()