Skip to content

Commit

Permalink
Add ability to supply custom path to cookie file
Browse files Browse the repository at this point in the history
Fixes #67
  • Loading branch information
n8henrie committed Oct 31, 2024
2 parents 88b411f + 6e0d130 commit 864a9d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
##

- Add `--version` flag (thanks @samiam)
- Add `-c` flag to specify custom path to cookie file (thanks @samiam)
- Fix new path to Firefox profile on MacOS (thanks @MattMuffin)
- Support Chrome's new v24 cookies (thanks @chrisgavin)
- Now requires python >= 3.9
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ with a standalone console script:

```console
$ pycookiecheat --help
usage: pycookiecheat [-h] -u URL [-b BROWSER] [-o OUTPUT_FILE]
usage: pycookiecheat [-h] -u URL [-b BROWSER] [-o OUTPUT_FILE] [--verbose]
[-c COOKIE_FILE]

Copy cookies from Chrome or Firefox and output as json

Expand All @@ -63,6 +64,9 @@ options:
-b BROWSER, --browser BROWSER
-o OUTPUT_FILE, --output-file OUTPUT_FILE
Output to this file in netscape cookie file format
--verbose, -v Increase logging verbosity (may repeat), default is `logging.ERROR`
-c COOKIE_FILE, --cookie-file COOKIE_FILE
Cookie file
```

### As a Python Library
Expand Down
7 changes: 7 additions & 0 deletions src/pycookiecheat/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def main() -> None:
"`logging.ERROR`"
),
)
parser.add_argument(
"-c",
"--cookie-file",
help="Cookie file",
)
parser.add_argument(
"-V",
"--version",
Expand All @@ -55,12 +60,14 @@ def main() -> None:
url=args.url,
browser=browser,
curl_cookie_file=args.output_file,
cookie_file=args.cookie_file,
)
else:
cookies = chrome_cookies(
url=args.url,
browser=browser,
curl_cookie_file=args.output_file,
cookie_file=args.cookie_file,
)

if not args.output_file:
Expand Down

0 comments on commit 864a9d1

Please sign in to comment.