Fixed donwloader to work with direct cookie. Cleaned some files.

This commit is contained in:
nedko 2024-09-10 14:50:21 +03:00
parent 7fd7492dc2
commit cf21d5cd74
7 changed files with 11 additions and 23 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
config.json config.json
cookies.txt
mcat_dl* mcat_dl*
.vscode/* .vscode/*

View File

@ -16,6 +16,8 @@ See config_example.json for the template.
Invoke `make` to compile. Requires libcurl. Invoke `make` to compile. Requires libcurl.
Login via browser and export `cid` cookie to cookies.txt (Netscape format)
Invoke `mcat_dl` with catalog ID as extra arguments to download. Invoke `mcat_dl` with catalog ID as extra arguments to download.
# Download File Structure # Download File Structure

View File

@ -185,13 +185,13 @@ bool CURL_DL::download(const string& url, ostream* out,
curl_easy_reset(m_handle); curl_easy_reset(m_handle);
// Enable cookie engine // Enable cookie engine
curl_easy_setopt(m_handle, CURLOPT_COOKIEFILE, ""); curl_easy_setopt(m_handle, CURLOPT_COOKIEFILE, "cookies.txt");
// Enable error messages // Enable error messages
curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_error); curl_easy_setopt(m_handle, CURLOPT_ERRORBUFFER, m_error);
// Set User-Agent // Set User-Agent
curl_easy_setopt(m_handle, CURLOPT_USERAGENT, "Internedko Archiver"); curl_easy_setopt(m_handle, CURLOPT_USERAGENT, "Internedko Downloader");
if ((nullptr == params) || (params->count("no-redir") == 0)) if ((nullptr == params) || (params->count("no-redir") == 0))
{ {

View File

@ -1,7 +0,0 @@
{
"comment": "This file will attempt to download MCLP001, MCLP001-X, MCLP002, ... MCLP010-X",
"prefix": "MCLP",
"suffix_try": "-X",
"start": 1,
"end": 10
}

View File

@ -1,10 +0,0 @@
{
"comment": "This file will attempt to download MCS1091, MCS1195, MCS1425, MCS1426",
"releases":
[
"MCS1091",
"MCS1195",
"MCS1425",
"MCS1426"
]
}

View File

@ -1,4 +0,0 @@
{
"Email": "USER",
"Password": "PASS"
}

View File

@ -160,12 +160,15 @@ int main(int argc, char **argv)
json_extract(config, "eyed3_exec", eyed3_exec); json_extract(config, "eyed3_exec", eyed3_exec);
json_extract(config, "metaflac_exec", metaflac_exec); json_extract(config, "metaflac_exec", metaflac_exec);
// Disable LOGIN
#if 0
ok = mcat.login(email, pass); ok = mcat.login(email, pass);
if (!ok) if (!ok)
{ {
cout << "Could not login" << endl; cout << "Could not login" << endl;
return -1; return -1;
} }
#endif
if (argc < 2) if (argc < 2)
{ {
@ -331,11 +334,14 @@ int main(int argc, char **argv)
} }
} }
// Disable LOGOUT
#if 0
ok = mcat.logout(); ok = mcat.logout();
if (!ok) if (!ok)
{ {
cout << "Could not log out" << endl; cout << "Could not log out" << endl;
} }
#endif
return 0; return 0;
} }