Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jul 29, 2024
1 parent 6cbc975 commit ae23016
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(CURL_USE_OPENSSL OFF)
set(CURL_USE_LIBPSL OFF)
set(CURL_DISABLE_ALTSVC ON)
set(CURL_DISABLE_CRYPTO_AUTH ON)
set(CURL_DISABLE_COOKIES ON)
set(CURL_DISABLE_COOKIES OFF)
set(CURL_DISABLE_HSTS ON)
set(CURL_DISABLE_HTTP_AUTH ON)
set(CURL_DISABLE_NETRC ON)
Expand Down
7 changes: 7 additions & 0 deletions src/m3u8httpclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ int m3u8httpclient_init(struct M3U8HTTPClient* const client) {
goto end;
}

code = curl_easy_setopt(client->curl, CURLOPT_COOKIEFILE, "");

if (code != CURLE_OK) {
err = M3U8ERR_CURL_SETOPT_FAILURE;
goto end;
}

client->error.message = malloc(CURL_ERROR_SIZE);

if (client->error.message == NULL) {
Expand Down
15 changes: 15 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ int main(int argc, argv_t* argv[]) {
int doh_url = 0;
int referer = 0;
int insecure = 0;
int disable_cookies = 0;
int debug = 0;
int disable_autoselection = 0;
int disable_progress = 0;
Expand Down Expand Up @@ -601,6 +602,20 @@ int main(int argc, argv_t* argv[]) {
err = M3U8ERR_CURL_SETOPT_FAILURE;
goto end;
}
} else if (strcmp(argument->key, "disable-cookies") == 0) {
if (disable_cookies) {
err = M3U8ERR_CLI_DUPLICATE_ARGUMENT;
goto end;
}

cerror->code = curl_easy_setopt(client->curl, CURLOPT_COOKIEFILE, NULL);

if (cerror->code != CURLE_OK) {
err = M3U8ERR_CURL_SETOPT_FAILURE;
goto end;
}

disable_cookies = 1;
} else if (strcmp(argument->key, "o") == 0 || strcmp(argument->key, "output") == 0) {
if (argument->value == NULL) {
err = M3U8ERR_CLI_ARGUMENT_VALUE_MISSING;
Expand Down
3 changes: 2 additions & 1 deletion src/program_help.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file is auto-generated. Use the ../tools/program_help.h.py tool to regenera
#define PROGRAM_HELP_H

#define PROGRAM_HELP \
"usage: kai [-h] [-v] -u URL [-k] [-A USER_AGENT] [-x URI] [--doh-url URL] [-e URL] [-r COUNT] [-H HEADER] [--debug] [-S] [--select-media MEDIA] [--select-stream VARIANT_STREAM] [--disable-autoselection] [--disable-progress-meter] [--prefer-ffmpegc] [-c CONCURRENCY] -o FILENAME\n" \
"usage: kai [-h] [-v] -u URL [-k] [-A USER_AGENT] [-x URI] [--doh-url URL] [-e URL] [-r COUNT] [-H HEADER] [--disable-cookies] [--debug] [-S] [--select-media MEDIA] [--select-stream VARIANT_STREAM] [--disable-autoselection] [--disable-progress-meter] [--prefer-ffmpegc] [-c CONCURRENCY] -o FILENAME\n" \
"\n" \
"A command-line utility to download contents from M3U8 playlists.\n" \
"\n" \
Expand All @@ -25,6 +25,7 @@ This file is auto-generated. Use the ../tools/program_help.h.py tool to regenera
" Specify how many times a failed HTTP request should be retried. Defaults to 0 (no retries).\n" \
" -H HEADER, --header HEADER\n" \
" Send a custom header to server. This argument can be specified multiple times.\n" \
" --disable-cookies Disable HTTP cookie handling.\n" \
" --debug Enable verbose logging of network requests for debugging purposes.\n" \
" -S, --show-streams List all available streams of the M3U8 playlist.\n" \
" --select-media MEDIA Select which media stream to download. By default, no additional media streams are downloaded.\n" \
Expand Down
7 changes: 7 additions & 0 deletions tools/program_help.h.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@
help = "Send a custom header to server. This argument can be specified multiple times."
)

parser.add_argument(
"--disable-cookies",
required = False,
action = "store_true",
help = "Disable HTTP cookie handling."
)

parser.add_argument(
"--debug",
required = False,
Expand Down

0 comments on commit ae23016

Please sign in to comment.