MoistCoder/CockyGrabber

System.IO.DirectoryNotFoundException

VityazevEgor opened this issue · 2 comments

I just added the code from the example to my project and when I run it I get this error - System.IO.DirectoryNotFoundException: "Could not find part of the path "C:\Users\PC\AppData\Roaming\Mozilla\Firefox\Profiles"."
I only have Chrome browser installed on my computer.

image

Yes there is currently a bug within the UniversalGrabber. When one of the Browsers isn't installed it throws an exception.

This will be and is already fixed in the next version (2.2.0) and until then I would reccommend to write a custom UniversalGraber.
Just copy the code of the UniversalGrabber and add if statements:

public IEnumerable<Chromium.Cookie> GetAllChromiumCookiesBy(Chromium.CookieHeader by, object value)
{
    List<Chromium.Cookie> cookies = new List<Chromium.Cookie>();

    // Add Cookies to list:
    if (CG.CookiesExist())
        cookies.AddRange(CG.GetCookiesBy(by, value));
    if (BG.CookiesExist())
        cookies.AddRange(BG.GetCookiesBy(by, value));
    if (VG.CookiesExist())
        cookies.AddRange(VG.GetCookiesBy(by, value));
    if (OG.CookiesExist())
        cookies.AddRange(OG.GetCookiesBy(by, value));
    if (OGG.CookiesExist())
        cookies.AddRange(OGG.GetCookiesBy(by, value));
    if (EG.CookiesExist())
        cookies.AddRange(EG.GetCookiesBy(by, value));

    return cookies;
}

sorry for the inconvenience