Comments (13)
未获取到 code_string字符串值吧。 你修改了什么地方?
2014-05-06 4:30 GMT-04:00 terry2010 [email protected]:
pcs -uUSER_NAME quota --urlc
COOKIE FILE: /root/.baidupcs/default.cookie
Password:
Login Failed: Can't get captch image from the server :
https://passport.baidu.com/cgi-bin/genimage?我发现报错以后, 简单改了一下代码,
url = pcs_utils_sprintf(URL_CAPTCHA "%s", code_string);
img = pcs_http_get_raw(pcs->http, url, PcsTrue, &imgsz); pcs_free(url);
if (!img) {
pcs_set_errmsg(handle, "Can't get captch image from the server : %s",url);
return PCS_NETWORK_ERROR;
}想看看为什么会出错, 但是 url 是没有参数的, 请问如何修正, 谢谢
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1
.
from baidupcs.
pcs_set_errmsg(handle, "Can't get captch image from the server : %s",url);
只是改了下报错的输出, 这里输出的 url 是
https://passport.baidu.com/cgi-bin/genimage?
from baidupcs.
在pcs.c的1587行前,增加代码: printf("html: %s\ncode_string: [%s]\n", html,
code_string); 如下:
printf("html: %s\ncode_string: [%s]\n", html, code_string);
i = 0;
try_login:
if (code_string[0]) {
res = pcs_get_captcha(pcs, code_string, captch, sizeof(captch));
if (res != PCS_OK) {
pcs_free(token);
pcs_free(code_string);
return res;
}
}
查看输出的html是什么?比较一下html中的code_string值和获取到的code_string值。 没有code_string值表示不需要验证码。
2014-05-06 4:48 GMT-04:00 terry2010 [email protected]:
pcs_set_errmsg(handle, "Can't get captch image from the server : %s",url);
只是改了下报错的输出, 这里输出的 url 是
https://passport.baidu.com/cgi-bin/genimage?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-42279327
.
from baidupcs.
在1660行,同样增加一行printf.
else {
if (code_string) pcs_free(code_string);
code_string = pcs_get_embed_query_token_by_key(html, "&codestring");
printf("html: %s\ncode_string: [%s]\n",
html, code_string);
if (!code_string) {
pcs_set_errmsg(handle, "Can't read the codestring from the
response. Response: %s", html);
pcs_free(token);
pcs_free(code_string);
return PCS_FAIL;
}
}
2014-05-06 4:55 GMT-04:00 gang zhuo [email protected]:
在pcs.c的1587行前,增加代码: printf("html: %s\ncode_string: [%s]\n", html,
code_string); 如下:printf("html: %s\ncode_string: [%s]\n", html, code_string
);
i = 0;
try_login:
if (code_string[0]) {
res = pcs_get_captcha(pcs, code_string, captch, sizeof(captch));
if (res != PCS_OK) {
pcs_free(token);pcs_free(code_string); return res; }
}
查看输出的html是什么?比较一下html中的code_string值和获取到的code_string值。 没有code_string值表示不需要验证码。
2014-05-06 4:48 GMT-04:00 terry2010 [email protected]:
pcs_set_errmsg(handle, "Can't get captch image from the server : %s",url);
只是改了下报错的输出, 这里输出的 url 是
https://passport.baidu.com/cgi-bin/genimage?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-42279327
.
from baidupcs.
加完的结果如下
COOKIE FILE: /root/.baidupcs/default.cookie
Password:
html: {"errInfo":{ "no": "0" }, "data": { "rememberedUserName" : "", "codeString" : "", "token" : "c4f28cb8f392b4acbe4e0d07846a2b88", "cookie" : "1", "usernametype":"", "spLogin" : "rate", "disable":"", "loginrecord":{ 'email':[ ], 'phone':[ ] } }}
code_string: []
html:
from baidupcs.
增加URL输出的地方有问题。换下边这样再输出URL看看。
问题在于:调用pcs_http_get_raw函数的同一行最后有一个pcs_free(url)把url释放掉了。
PcsRes pcs_get_captcha(Pcs handle, const char *code_string, char *captcha,
int captchaSize)
{
struct pcs *pcs = (struct pcs *)handle;
char *url, *img;
size_t imgsz;
captcha[0] = '\0';
if (!pcs->captcha_func) {
pcs_set_errmsg(handle, "No captch function, please regist the function by
call pcs_setopt(handle, PCS_OPTION_CAPTCHA_FUNCTION, pFun).");
return PCS_NO_CAPTCHA_FUNC;
}
url = pcs_utils_sprintf(URL_CAPTCHA "%s", code_string);
img = pcs_http_get_raw(pcs->http, url, PcsTrue, &imgsz);
if (!img) {
pcs_set_errmsg(handle, "Can't get captch image from the server. url: %s",
url);
pcs_free(url);
return PCS_NETWORK_ERROR;
}
if (!(*pcs->captcha_func)((unsigned char *)img, imgsz, captcha,
captchaSize, pcs->captcha_data)) {
pcs_set_errmsg(handle, "Can't get captch from the captcha, which is regist
by user.");
pcs_free(url);
return PCS_GET_CAPTCHA_FAIL;
}
pcs_free(url);
return PCS_OK;
}
2014-05-06 5:12 GMT-04:00 terry2010 [email protected]:
加完的结果如下
COOKIE FILE: /root/.baidupcs/default.cookie
Password:
html: {"errInfo":{ "no": "0" }, "data": { "rememberedUserName" : "",
"codeString" : "", "token" : "c4f28cb8f392b4acbe4e0d07846a2b88", "cookie" :
"1", "usernametype":"", "spLogin" : "rate", "disable":"", "loginrecord":{
'email':[ ], 'phone':[ ] } }}
code_string: []
html:code_string:
[captchaservice65383333305a4c75786e55674f3453774e5936704e5630726357556e76356e52727051473239386465652b3765516b2f5a6c45647150414c754a674d444c454f586b677778704c3558665641783176355a516541486955543365647043726f635431426c7a5551537932534344744150726d7a452f74624738664b5776516a646b55614d46417044322f384f522f68444b414f6436665974354f6433535037684f7a5a39467757794159544653657867635a5558675a65716e4a76645171656d443671456a4e4273656f76666b3559376a504961464f746b586c6850694d56696e50612f6677316279302f4467305a5468536237362f506931504f706b634d62317455595934646d4c363672534a5747334d4f5949753950416170743650314c4c70426b4366437a2f5a394e55764f4e724763516434754757596f2f496c37543077]Login Failed: Can't get captch image from the server :
https://passport.baidu.com/cgi-bin/genimage?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-42281204
.
from baidupcs.
增加libcurl错误输出后新的函数:
PcsRes pcs_get_captcha(Pcs handle, const char *code_string, char *captcha, int captchaSize)
{
struct pcs *pcs = (struct pcs *)handle;
char *url, *img;
size_t imgsz;
captcha[0] = '\0';
if (!pcs->captcha_func) {
pcs_set_errmsg(handle, "No captch function, please regist the function by call pcs_setopt(handle, PCS_OPTION_CAPTCHA_FUNCTION, pFun).");
return PCS_NO_CAPTCHA_FUNC;
}
url = pcs_utils_sprintf(URL_CAPTCHA "%s", code_string);
img = pcs_http_get_raw(pcs->http, url, PcsTrue, &imgsz);
if (!img) {
pcs_set_errmsg(handle, "Can't get captch image from the server. url: %s. Error message: %s", url, pcs_http_strerror(pcs->http));
pcs_free(url);
return PCS_NETWORK_ERROR;
}
if (!(*pcs->captcha_func)((unsigned char *)img, imgsz, captcha, captchaSize, pcs->captcha_data)) {
pcs_set_errmsg(handle, "Can't get captch from the captcha, which is regist by user.");
pcs_free(url);
return PCS_GET_CAPTCHA_FAIL;
}
pcs_free(url);
return PCS_OK;
}
from baidupcs.
按最后的修改,还是之前的问题
COOKIE FILE: /root/.baidupcs/default.cookie
Password:
html: {"errInfo":{ "no": "0" }, "data": { "rememberedUserName" : "", "codeString" : "", "token" : "c4f28cb8f392b4acbe4e0d07846a2b88", "cookie" : "1", "usernametype":"", "spLogin" : "rate", "disable":"", "loginrecord":{ 'email':[ ], 'phone':[ ] } }}
code_string: []
html:
from baidupcs.
很奇怪,能告知使用什么操作系统、操作系统版本、使用什么编译器、编译器版本、使用的C库吗?
2014-05-06 5:44 GMT-04:00 terry2010 [email protected]:
按最后的修改,还是之前的问题
COOKIE FILE: /root/.baidupcs/default.cookie
Password:
html: {"errInfo":{ "no": "0" }, "data": { "rememberedUserName" : "",
"codeString" : "", "token" : "c4f28cb8f392b4acbe4e0d07846a2b88", "cookie" :
"1", "usernametype":"", "spLogin" : "rate", "disable":"", "loginrecord":{
'email':[ ], 'phone':[ ] } }}
code_string: []
html:code_string:
[captchaservice33663432615131735a4a5944476a426a41373071666b6865466e66746f465645346a76795456436b6c70446c79444267793966586542664a517438644b6e41787679776b484d68646f2b634f6347657453324744336f356e442b6d5a6446684d456e4a334c45553864764e627731785353434b59646148682b43373168584b57413239304549343674645a52384770504b3832586a4b4f476f79422b466158695a6a64395963567647746a636a2f695456717736384935554159744142516d4748724a4259514e64776e7363674e5141374d6a717743736a364954455a656f302b31776d4e4633534a5a5a3563736b69306d366f754d6a784b4b6f48496838374b4268386f706767757938586a70655a65624a613579706a2b76686f714c323073533247637361424b4b6a444c6b4449557362665947665967522b5a636b66784877]
Login Failed: Can't get captch image from the server. url:
https://passport.baidu.com/cgi-bin/genimage?. Error message: (null)—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-42283502
.
from baidupcs.
64位系统
CentOS release 6.5 (Final)
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
from baidupcs.
能拿一下最新代码后,再试一下吗? 再不行的话,我虚拟机装一个64bit系统调试一下。 原因应该是
libcurl的curl_easy_setopt函数传入的值应该是long类型,但是代码中很多地方使用了0和1而不是0L和1L。我改了一下,已经提交到github了,你能帮忙再试一下?
2014-05-06 5:58 GMT-04:00 terry2010 [email protected]:
64位系统
CentOS release 6.5 (Final)gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-42284559
.
from baidupcs.
我把服务器权限给你, 密码发你 gmail 邮箱了 , 文件在 /root 下面
from baidupcs.
修好了,修改部分见
1ca245d
另外,我安装到/usr/local/bin下了,如果你需要删除的话,直接 rm /usr/local/bin/pcs。
十分感谢提供服务器!!
from baidupcs.
Related Issues (20)
- Error: Can't create download thread.
- Why the speed turn to 0B/s when have downloaded part of the file? HOT 1
- Error: Couldn't connect to server
- ls: cannot access '/home/kk/.pcs/captcha.gif': No such file or directory HOT 1
- 下载的图片都是损坏的 HOT 1
- error_code:31200
- upload slice failed
- centos7下面编译全是错误,编译不过去 HOT 1
- cmake是不是比autoconf autotools要简洁方便啊
- .NET版本,前几天还运行的好好的,这两天都传输不成功了,好像没有断点续传了
- baidupcs login Error: Timeout was reached: http://pan.baidu.com/disk/home
- 咨询作者(维护问题) HOT 9
- Getting unreadable chinese Captcha + fails on latin letters captchas HOT 1
- 請問 Ubuntu 上有辦法使用嗎? HOT 1
- 打包安装失败 HOT 1
- mac版本下载错误
- 请教一下mac版是否用到了P2P? HOT 1
- 无法通过邮箱登录! HOT 1
- 测试一下
- Mac build fails with link problem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baidupcs.