Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading to a folder other than Downloads? #174

Open
markosopcic opened this issue Aug 9, 2022 · 5 comments
Open

Downloading to a folder other than Downloads? #174

markosopcic opened this issue Aug 9, 2022 · 5 comments

Comments

@markosopcic
Copy link

Hi!
Has anyone tried downloading to another folder other dan Downloads? With Scoped Storage from Android 11 I can't seem to be able to download a video with the library to any other folder because i get the following exception: com.yausername.youtubedl_android.YoutubeDLException: ERROR: unable to open for writing: [Errno 1] Operation not permitted:

I'd like to avoid getting the MANAGE_EXTERNAL_STORAGE permission if possible. If I'm not mistaken, the only way to have this work then would be using the MediaStore API, for which I would need access to a Stream of the data and saving it through the MediaStore API instead of the library saving the file itself.

@JunkFood02
Copy link
Collaborator

Please check JunkFood02/Seal#34

@JunkFood02
Copy link
Collaborator

In addition, MediaStore API is used for media and files created in Android Framework and stored in the system media library. In this case, we use native methods/APIs to access the filesystem in the yt-dlp python codes. So the only way to deal with the permission problem is to use SAF.

@markosopcic
Copy link
Author

You also don't like giving permission to access all files? It would let you save anywhere.

@JunkFood02
Copy link
Collaborator

You also don't like giving permission to access all files? It would let you save anywhere.

Yes, I didn't request MANAGE_EXTERNAL_STORAGE in Seal, the request for this permission is quite complicated tho. It's not a good practice to request unnecessary permissions.

@chaikovskiy99
Copy link

chaikovskiy99 commented Oct 11, 2022

The simplest way is to download to external cache/storage directory to start with, because, you have access to file api there. Then you move the downloaded content to Mediastore or SAF location, as you wish, you don't need any storage permission to write to mediastore on android 9+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants