I'd like to get one link from another using one or two parameters. So in Python code should look like:
opts = {"-g"}
with yt_dlp.YoutubeDL(opts) as ydl:
z = ydl.download(m[0])
print("> z:", z)
where m stores the link as list. To be clear, I just want to replicate console command like:
yt_dlp [link] -g
or
yt_dlp [link] -f b -g
and store it in the string.
I know that opts set should look different but can't find how.
Error I get using opts as set:
Traceback (most recent call last):
File "E:\aimpx.py", line 27, in <module>
with yt_dlp.YoutubeDL(opts) as ydl:
File "C:\Python\Python39\lib\site-packages\yt_dlp\YoutubeDL.py", line 644, in __init__
stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout
AttributeError: 'set' object has no attribute 'get'The issue arises because `opts` is a set, and `YoutubeDL` expects keyword arguments.
import yt_dlp
m = ['http://example.com']
opts = {'gif': True}
with yt_dlp.YoutubeDL(opts) as ydl:
z = ydl.extract_info(m[0], download=False)
print('> z:', z)