Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picJsonPage is empty #3

Closed
markx opened this issue Jan 9, 2015 · 6 comments
Closed

picJsonPage is empty #3

markx opened this issue Jan 9, 2015 · 6 comments

Comments

@markx
Copy link

markx commented Jan 9, 2015

It gets empty picJsonPage, thus json.loads(picJsonPage) raises exception.

@abcfy2
Copy link
Owner

abcfy2 commented Jan 10, 2015

Ok. Maybe tencent comic has changed its page structure. I'll fix this issue, wait please.

@abcfy2
Copy link
Owner

abcfy2 commented Jan 10, 2015

I've found the reason. Because the picJsonPage url like http://pad.ac.qq.com/View/mGetPicHash?id=512991&cid=27 must request with cookie, otherwise it will return nothing.

So I will parse the cookie, it may take some times.

@abcfy2
Copy link
Owner

abcfy2 commented Jan 10, 2015

Bug fixed. Please check 535702b

Cookie must contains ac_refer=.

Please checkout the latest code and try again.

Windows bundle package is uploading.

@markx
Copy link
Author

markx commented Jan 10, 2015

Good job!
May I ask you how you found the reason and what tools did you use?

@abcfy2
Copy link
Owner

abcfy2 commented Jan 10, 2015

Chrome F12 developer tools and Firefox firebug add-on is my friends.

Also, the command tool curl is an awesome tool.

Curl can simulate and fake the browser request, it's helpful when debugging the request headers.

When I use curl -v http://pad.ac.qq.com/View/mGetPicHash?id=512991&cid=27, returns nothing, but chrome works well. So I compare the headers between curl and chrome, and finally I've found curl -v -H 'Cookie:xxxxxxxxxxxx(copy from chrome)' can get the json string. Then I know must request with Cookie. But the cookie string is too long, so I use firefox and open firebug to check the cookie. After flush all cookies, I've found that when the cookie add the ac_refer field, picjsonpage will return json string.

After all, use curl to verify.

curl -v -H 'Cookie: ac_refer=http://pad.ac.qq.com/Comic/comicInfo/id/512991' 'http://pad.ac.qq.com/View/mGetPicHash?id=512991&cid=27'

and it works.

@markx
Copy link
Author

markx commented Jan 10, 2015

Cool!
Thanks.

@markx markx closed this as completed Jan 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants