Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 06-12-2011, 12:38 PM   #1
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
Exclamation HTTP Request - Mimic Different Browsers?

I am trying to write a recipe for a site that doesn't seem to respond to the calibre HTTP requests with anything valid.

When I open the RSS url in Safari it tailors the XML to the browser
feed://www.frontporchrepublic.com/feed/rss/

When I open the web site directly in a recipe:
http://www.frontporchrepublic.com
I get
HTTP Error 403: Bad Behavior

If I open the RSS url:
feed://www.frontporchrepublic.com/feed/rss/
I get
<urlopen error unknown url type: feed>

I'm guessing this is because the HTTP Request coming from Calibre doesn't specify a browser type that the web site recognizes.

Is there a way to populate the HTTP Request with information to make the website think that Calibre is Firefox or Safari?

Thanks!
EnergyLens is offline   Reply With Quote
Old 06-12-2011, 12:43 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre mimics browsers anyway by default. IIRC it pretends to be Firefox 3.6.13 on Linux by default.

You can change this by implementing get_browser in your recipe. See the browser() function in the calibre source source
kovidgoyal is offline   Reply With Quote
Advert
Old 06-12-2011, 06:16 PM   #3
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by EnergyLens View Post
I get
HTTP Error 403: Bad Behavior
Search for "Bad Behavior" here, or look at my Skeptic recipe.
The Bad Behavior module can be configured to require headers that the recipe browser may not supply by default.
See this post for a possible fix:
https://www.mobileread.com/forums/sho...93&postcount=2
Starson17 is offline   Reply With Quote
Old 06-13-2011, 09:10 AM   #4
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
Thanks & Thanks

@Starson17 - your code snippet was just what I needed
@kovidgoyal - thanks for inspiring me to check the source
EnergyLens is offline   Reply With Quote
Old 06-13-2011, 02:01 PM   #5
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by EnergyLens View Post
@Starson17 - your code snippet was just what I needed
I'm glad it helped.
Starson17 is offline   Reply With Quote
Advert
Reply

Tags
http error 403, http request


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Favorite Browsers =X= Android Devices 10 06-23-2011 08:01 PM
Browsers not connecting lesliesch enTourage eDGe 9 06-06-2011 08:59 PM
Books in Browsers? tomsem News 0 12-18-2010 11:45 PM
http://www.morphzone.org request please trott3r Recipes 11 10-15-2010 02:20 PM
What's the differerence between the K2 and K3 browsers? gollu Amazon Kindle 0 08-28-2010 10:49 AM


All times are GMT -4. The time now is 12:16 PM.


MobileRead.com is a privately owned, operated and funded community.