[YTDLPWrapper] Enable using netrc file #3228
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This change enables using netrc file in YTDLPWrapper plugin to allow yt-dlp to use authentication data stored in the netrc file.
The netrc file is a structured text file that - in principle - stores the credentials used during logging in to remote machines.
https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html
The yt-dlp can use the netrc file to store credentials data (logins, passwords) for websites that need logging in to make access its contents (videos, live transmissions, etc.).
Link to yt-dlp's documentation describing using the netrc file: https://github.com/yt-dlp/yt-dlp#authentication-with-netrc
For some reason enabling just the "--netrc" flag (in code - by inserting
"usenetrc": True
does not seem to work so I used a workaround with using "cat" on a file stored in the default location - user's home directory.If the netrc file does not exist, a warning is displayed, but the link generation process is not interrupted so the change should be transparent for users that have not created the file.
I leave it open to consider using a different file location or adding the option to customize this option for example in the user interface, from the system settings.
Nevertheless in my opinion it should be possible to use netrc file (or - possibly other way) to store credential data for yt-dlp used as a base mechanism of stream URL extraction in YTDLPWrapper plugin.
Best regards,
mp107