[ie/patreon:campaign] Stricter URL matching (#11235)
[yt-dlp3.git] / devscripts / make_issue_template.py
blob8135689c7e77f6b68c1ad424b053ca5f0fb48ce3
1 #!/usr/bin/env python3
3 # Allow direct execution
4 import os
5 import sys
7 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10 import re
12 from devscripts.utils import get_filename_args, read_file, write_file
14 VERBOSE_TMPL = '''
15 - type: checkboxes
16 id: verbose
17 attributes:
18 label: Provide verbose output that clearly demonstrates the problem
19 options:
20 - label: Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
21 required: true
22 - label: "If using API, add `'verbose': True` to `YoutubeDL` params instead"
23 required: false
24 - label: Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below
25 required: true
26 - type: textarea
27 id: log
28 attributes:
29 label: Complete Verbose Output
30 description: |
31 It should start like this:
32 placeholder: |
33 [debug] Command-line config: ['-vU', 'https://www.youtube.com/watch?v=BaW_jenozKc']
34 [debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
35 [debug] yt-dlp version nightly@... from yt-dlp/yt-dlp [b634ba742] (win_exe)
36 [debug] Python 3.8.10 (CPython 64bit) - Windows-10-10.0.22000-SP0
37 [debug] exe versions: ffmpeg N-106550-g072101bd52-20220410 (fdk,setts), ffprobe N-106624-g391ce570c8-20220415, phantomjs 2.1.1
38 [debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
39 [debug] Proxy map: {}
40 [debug] Request Handlers: urllib, requests
41 [debug] Loaded 1893 extractors
42 [debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
43 yt-dlp is up to date (nightly@... from yt-dlp/yt-dlp-nightly-builds)
44 [youtube] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc
45 <more lines>
46 render: shell
47 validations:
48 required: true
49 - type: markdown
50 attributes:
51 value: |
52 > [!CAUTION]
53 > ### GitHub is experiencing a high volume of malicious spam comments.
54 > ### If you receive any replies asking you download a file, do NOT follow the download links!
56 > Note that this issue may be temporarily locked as an anti-spam measure after it is opened.
57 '''.strip()
59 NO_SKIP = '''
60 - type: checkboxes
61 attributes:
62 label: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
63 description: Fill all fields even if you think it is irrelevant for the issue
64 options:
65 - label: I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\\* field
66 required: true
67 '''.strip()
70 def main():
71 fields = {'no_skip': NO_SKIP}
72 fields['verbose'] = VERBOSE_TMPL % fields
73 fields['verbose_optional'] = re.sub(r'(\n\s+validations:)?\n\s+required: true', '', fields['verbose'])
75 infile, outfile = get_filename_args(has_infile=True)
76 write_file(outfile, read_file(infile) % fields)
79 if __name__ == '__main__':
80 main()