commit files
This commit is contained in:
24
ythdd_extractor.py
Normal file
24
ythdd_extractor.py
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/python3
|
||||
import yt_dlp, toml
|
||||
|
||||
ytdl_opts = {
|
||||
#"format": "bv*[height<=720]+ba", # to be defined by the user
|
||||
#"getcomments": True,
|
||||
#"extractor_args": {"maxcomments": ...},
|
||||
#"writeinfojson": True,
|
||||
#"progress_hooks": my_hook,
|
||||
"outtmpl": {
|
||||
"default": "%(id)s.%(ext)s",
|
||||
"chapter": "%(id)s.%(ext)s_%(section_number)03d_%(section_title)s.%(ext)s"
|
||||
},
|
||||
"simulate": True
|
||||
}
|
||||
|
||||
def extract(url, getcomments=False, maxcomments=""):
|
||||
if getcomments:
|
||||
ytdl_opts['getcomments'] = True
|
||||
if maxcomments:
|
||||
ytdl_opts['extractor_args'] = {'youtube': {'max_comments': [maxcomments, "all", "all", "all"]}}
|
||||
with yt_dlp.YoutubeDL(ytdl_opts) as ytdl:
|
||||
result = ytdl.extract_info(url, download=False)
|
||||
return result
|
||||
Reference in New Issue
Block a user