View Single Post
Old 09-26-2010, 10:36 PM   #5
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Quote:
Originally Posted by Starson17 View Post
1) You start with your recipe and make sure you're removing nothing, then print what the site sends you. You compare that to what you see in FireFox. If there's something that FireFox gets, but Calibre does not, then it's time to figure out why. That's where you are now (I assume you are sure that your recipe does not receive pcard, even with everything turned on).

2) Once you're sure that you're getting different things, you start tracking down how the site knows the difference between Calibre's request and FF's request. It could be useragent, headers, cookies, etc. TamperData (or Live HTTP Headers) will tell you what FireFox sends.
These commands inside get_browser will show you what Calibre sends:
Code:
        # Print HTTP headers.
        br.set_debug_http(True)
        br.set_debug_responses(True)
        br.set_debug_redirects(True)
Your job is to compare FF to C. TamperData will let you change what FF sends. It's easier to get FF to mimic Calibre because TD will let you change headers just before they are sent, but you can go either way. Eventually, you'll figure out why there's a difference between what the site sends FF and what it sends C.

As an example, I ran into this problem with a Skeptic Blog - I got a Bad Behavior error. It turned out the site wanted an Accept header. I also ran into it with a Comic recipe. That turned out that it wanted a referer header, etc.
Alright, this one is kicking my rear. I have a question about the #print http headers. Where exactly will that information be output? do i need to make print statements? Will it be inside the myrecipe.txt or do i need to do something special ?
TonytheBookworm is offline   Reply With Quote