Where does the brave browser keep its cookies?

I am using brave-browser on Linux:

$ uname -a
Linux debian 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux

$ which brave-browser
/usr/bin/brave-browser

$ brave-browser --version
Brave Browser 128.1.71.16 nightly
~
and brave-browser seems to be at: /opt/brave.com/brave-nightly/brave-browser-nightly

$ pwd
/usr/bin

$ which brave-browser
/usr/bin/brave-browser

$ ls -l /usr/bin/brave-browser
lrwxrwxrwx 1 root root 31 Dec 22 04:36 /usr/bin/brave-browser → /etc/alternatives/brave-browser

$ ls -l /etc/alternatives/brave-browser
lrwxrwxrwx 1 root root 30 Dec 22 04:36 /etc/alternatives/brave-browser → /usr/bin/brave-browser-nightly

$ ls -l /usr/bin/brave-browser-nightly
lrwxrwxrwx 1 root root 50 Aug 20 09:18 /usr/bin/brave-browser-nightly → /opt/brave.com/brave-nightly/brave-browser-nightly

$ ls -l /opt/brave.com/brave-nightly/brave-browser-nightly
-rwxr-xr-x 1 root root 1544 Aug 20 09:18 /opt/brave.com/brave-nightly/brave-browser-nightly
~
but I wasn’t able to instruct brave to load the cookies because I can’t find where brave keeps them:

_DIR=“/home/user”
find “${_DIR}” -type d -name “.config”

_DIR=“/opt/brave.com/brave-nightly/brave-browser-nightly”
find “${_DIR}” -type d -name “.config”

$ ./yt-dlp --cookies-from-browser brave MG_UzMTh82w
Extracting cookies from brave
ERROR: could not find brave cookies database in “/home/user/.config/BraveSoftware/Brave-Browser”

$ ./yt-dlp --cookies MG_UzMTh82w

So, where (on which directory) are they kept.

lbrtchx

I’ve never used yt-dlp before, so if there’s a config file, mine is the default. It finds the cookies but can’t decrypt all of them. I would use the keyring option to see if that fixes it, but can’t work out how to.

--cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER]

$ yt-dlp --cookies-from-browser brave MG_UzMTh82w
Extracting cookies from brave
[Cookies] Loading cookie      0/  1175
WARNING: failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed.
Possibly the key is wrong?
Extracted 765 cookies from brave (409 could not be decrypted)

The only way to specify a cookie location is by using a netscape-formatted file, which I do not believe Chrome browsers have, in which case your problem is something other than knowing the location of the cookies.
From the yt-dlp docs:
--cookies FILE Netscape formatted file to read cookies from and dump cookie jar in

As you can notice on my posts on the yt-dlp forum, I think I found where brave browser keeps the IndexedDB data.

// __ ERROR: [youtube] … Sign in to confirm you’re not a bot. Use --cookies-from-browser or --cookies for the authentication …

https://github.com/yt-dlp/yt-dlp/issues/11981
~

since you have never used yt-dlp, a config file used by brave browser you meant, right? Which options on it help while trying to solve that problem? Basically, where the IndexedDB data is kept and whatever other data is needed to access it.

Hmm! What do you mean? So, session cookies are encrypted on the server end and placed on the clients? In such cases, I would say, just sending them back to the server is all you would need to care about, no?

I am sure someone has delved into those matters more deeply. Going “Settings” > “More tools” > “Applications” and expanding the “Cookies” tree, I can see all the cookies associated with the youtube.com domain. They all seem to be plain text and the fields/column definitions of the IndexedDB data are straight forward. There should be an easy way to extract that data from that DB and convert it into a netscape-formatted file.

Or, there should be an easier way to do that using brave. Is there a way to paste a bunch of youtube uris and have brave download all the data and place in a local directory in an automated fashion probably instrumented through Selenium?

lbrtchx

I mentioned the config file because without it ever being changed, yt-dlp has no problem finding the cookies. So if you’ve changed something there, unchange it. I did not mean the browser config file, I meant the yt-dlp one.

The cookies are encrypted on the client, which is why there is a command line option in yt-dlp to decrypt them. A cookie encrypted on the server could be stolen and sent by any client without needing the encryption key, thus negating any benefit of encryption.

You can probably create a netscape-formatted cookies file based on the data you found in Brave Settings, and you can download youtube videos by concatenating all the fetched files whose name starts with “videoplayback”. But seeing as yt-dlp works out of the box and does not need to be told the answer to the question in this thread’s title, I would simply delete the config file and run the usual command.

In a Brave Browser New Window, go to:

brave://version

and scroll down to “Profile Path” - that path very likely ending with “Default” - and locate the “BraveSoftware” folder in that path.

That is the important data folder to back up, because your Brave Browser Profile(s) is(are) stored within that folder’s sub-folders.

Cookies are within your Brave Browser Profile folder.

Your original Brave Browser Profile, is named “Default”.


Linux OS directory map:


this is what I see:
Profile Path /home/user/.config/BraveSoftware/Brave-Browser-Nightly/Default

I don’t see the picture you included.

Also, as weird as it may sound, I kept probing this issue and I discovered that youtube apparently doesn’t like when you try to set the “–format <format id>” option. I have no idea why they would do this. Probably for “security reasons” or because the webp file format somehow includes calls home? or whatever. I don’t need all pictures to be HD. I actually like the mp4 format because at times I need to use those videos where I teach and I have noticed that, since most social settings have Windows installed, they all seem to like mp4.

@lbrtchx the picture they showed was supposed to be a thing to show what each area holds. Was supposed to be something of a sheet to try to learn to navigate things. That said, a lot of things they share usually is an overwhelming amount of information and often is more educational for related issues and not anything that leads to an immediate solution for the problem at hand.

Right, so once you’re there, it shows you everything that’s in Brave. You could just search at that point for cookies or whatever. For example, going from Windows, my profile path is C:\Users\saoir\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default

I did a search for cookies and found it’s under Network

Btw, I’m going to tag in @Mattches. He should be coming back after the weekend. He’ll have a lot to catch up on but hoping maybe he’ll be able to see and give better information based on your initial concern and everything else.

OK, here are two features I would love to see implemented in “brave” when you guys come back ;-):

  1. an option to download links locally reflecting as best as it could the link based on the URL (not all URL could be straightforwardly rewritten into a path) and all links on the pages should be rewritten as relative links (browsers do that anyway, I am asking for it to be more customizable). If user just klick on a link the temp cache should be used if it keeps the more over a link for, say, a second then after the file is downloaded when you click on it, it should be kept in a sub directory determined by the user, e.g.:

https://plato.stanford.edu/entries/aristotle-commentators/” -> “<Lokal Web Directory>/edu/stanford/plato/entries/aristotle-commentators.html”

https://jprs.co.jp/en/topics/2024/240920.html” -> “<Lokal Web Directory>/co.jp/jprs/en/topics/2024/240920.html”

at times subdomains parsing get messy, so who is may be needed.

1.1) user chooses in the configuration file where in their local fs do they want the downloads (instead of using a temporary “cache” folder)
1.2) doing your actual work in an air-gapped computer has become a thing; so, user should be even able to keep some files off line and update and import a list with the files being kept off line
2) there should be an option to, if not totally, semi automate the download of a bunch of files in a batch of URLs
lbrtchx

How should the subdomain be laid out as a filesystem path within the local subdirectory defined by the user?

take for example the link: https://pmc.ncbi.nlm.nih.gov/articles/PMC8192439/pdf/nihms-1684296.pdf

I think the filesystem path should be: gov/nih/pmc.ncbi.nlm/articles/PMC8192439/pdf

host pmc.ncbi.nlm.nih.gov
pmc.ncbi.nlm.nih.gov has address 34.107.134.59
pmc.ncbi.nlm.nih.gov has IPv6 address 2600:1901:0:c831::

host pmc.nlm.nih.gov
Host pmc.nlm.nih.gov not found: 3(NXDOMAIN)

host pmc.nih.gov
pmc.nih.gov has address 143.244.220.150
Host pmc.nih.gov not found: 3(NXDOMAIN)

host ncbi.nlm.nih.gov
ncbi.nlm.nih.gov has address 130.14.29.110
ncbi.nlm.nih.gov has IPv6 address 2607:f220:41e:4290::110
ncbi.nlm.nih.gov mail is handled by 10 nihcesxway5.hub.nih.gov.
ncbi.nlm.nih.gov mail is handled by 10 nihcesxway2.hub.nih.gov.
ncbi.nlm.nih.gov mail is handled by 10 nihcesxway3.hub.nih.gov.
ncbi.nlm.nih.gov mail is handled by 10 nihcesxway.hub.nih.gov.
ncbi.nlm.nih.gov mail is handled by 10 nihcesxway4.hub.nih.gov.

host nlm.nih.gov
nlm.nih.gov has address 130.14.16.110
nlm.nih.gov has IPv6 address 2607:f220:41e:1016::110
nlm.nih.gov mail is handled by 10 nihcesxway6.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxway3.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxwayst06.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxwayst03.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxwayst04.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxwayst05.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxway5.hub.nih.gov.
nlm.nih.gov mail is handled by 10 nihcesxway4.hub.nih.gov.

host nih.gov
nih.gov has address 156.40.212.210
nih.gov mail is handled by 10 nihcesxway3.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxway6.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxway4.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxway5.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxwayst06.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxwayst03.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxwayst04.hub.nih.gov.
nih.gov mail is handled by 10 nihcesxwayst05.hub.nih.gov.

I think browsers do this internally anyway.

As @289wk stated, cookies are in the user data profile folder. Follow the path shown in brave://version on your system and you should see a Cookies file right there. Here’s how it looks on macOS:

@Saoiray not sure why you had to go into a Network folder — might be Windows specific. I don’t appear to even have a Network directory.

Yeah, no clue. All I know is when I went there, just saw like below:




So those are all that show up at C:\Users\saoir\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default which is my profile path.

Searching for cookies had me either going to Extension Cookies or to Network and then Cookies. Not sure which is more accurate. But that’s on Windows 11 Pro and Brave 1.73.104

@Saoiray interesting thank you for clarifying. Not entirely sure what the deal is here — will ask and see if maybe it’s Windows specific.