I struggled to get a basic news custom recipe to login to one of my private blogs ... finally found this post deep into the thread:
https://www.mobileread.com/forums/sho...&postcount=605
Quote:
Originally Posted by kiklop74
Add this to your recipe and it should work:
Code:
needs_subscription = True
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
br.open('http://content.nejm.org/cgi/login?uri=%2F')
br.select_form(nr=0)
br['username'] = self.username
br['code' ] = self.password
br.submit()
return br
|
Thanks Kiklop74!
Nothing else online even got me close to that. I never found the "needs_subscription = True" part attached to the rest of the code, for whatever reason. So I finally got it all together and made it work.
My blog is a WP one, privatized, and I couldn't find anything online written about anyone using Calibre to login to a WP blog.
So this is what I came up with that will allow a privatized blog, like one using "Private WP" plugin with WP:
Code:
needs_subscription = True
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
br.open('Your-WP-Blog-Login-Page-URL-HERE')
br.select_form(name='loginform')
br['log'] = self.username
br['pwd' ] = self.password
br.submit()
return br
In my case, using Private WP one is auth_dir automatically to the top directory where the blog is located, so when Calibre is being used to get any RSS it has to login first, thus the top WP directory is all you need to get to the login. In my case it was like: "http://URL.com"
It works great. Now I just need to get a better recipe set up to work with the Carrington Theme for WP, or change my theme 'cause it's awful looking, whereas other blogs I have used basic recipe to fetch rss look nice. There is no difference between all these blogs recipes in how they are parsed, and none but that one uses "Carrington" so it seems that's the basic difference, and I'm not wanting to get deep into coding to make it better. It'd be much easier to just switch WP themes. FWIW.