12-16-2023, 04:20 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2023
Device: Pocketbook inkpad 4
|
Log in for custom news source
Hello!
I want to ask if someone could help me with a new news source i tried to add. The news outlet has a own RSS feed which i am using, but i also need to log in to get the whole news article text. I tried the code given in the examples, but i think the log in page of the news outlet is somehow different and the code doesnt get it. Can someone please help me with the code? Here is the news outlet page: https://www.postimees.ee/ Here is the login page: https://www.postimees.ee/myaccount?iframe=true Here is the RSS feed link: https://www.postimees.ee/rss And here is the code I put together from the examples: Code:
from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1702716630(BasicNewsRecipe): title = 'Postimees' oldest_article = 7 max_articles_per_feed = 100 auto_cleanup = True needs_subscription = True feeds = [ ('Postimees', 'https://www.postimees.ee/rss'), ] def get_browser(self): br = BasicNewsRecipe.get_browser(self) if self.username is not None and self.password is not None: br.open('https://www.postimees.ee/myaccount?iframe=true') br.select_form(name='login') br['USERID'] = self.username br['PASSWORD'] = self.password br.submit() return br mechanize._mechanize.FormNotFoundError: no form matching name 'login' If somene need more infos i would be glad to provide and thank you guys in advance! |
12-19-2023, 02:08 AM | #2 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2023
Device: Pocketbook inkpad 4
|
Maybe I can specify my question a little more, i am searching for a command, which can take something else than the form to select, as the log in window on the webpage is not a form it is only an iframe in which is a api from a third party which is also not a form. So I need a command which lets me choose user ID, password and submit button with for example name or class or action. Is this possible and if yes what would be the command?
|
Advert | |
|
12-19-2023, 02:13 AM | #3 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
there's no such command. you should instead navigate to whatever document is loaded in the iframe and login using the form there. If there is no form that would imply some kind of javascript bassed login, which is unsupported. For those you would need to reverse negineer the javascript and make the equivalent http requests yourself.
|
12-19-2023, 02:21 AM | #4 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2023
Device: Pocketbook inkpad 4
|
Ok thanks for your help!
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using print_version for custom news source | sexymax15 | Recipes | 0 | 06-15-2011 10:53 AM |
How to remove a custom news source | NSILMike | Recipes | 2 | 04-17-2011 07:15 PM |
Custom News Source | scrumhalf | Recipes | 5 | 11-26-2010 11:30 AM |
Custom news source - for forums | RichD | Calibre | 0 | 01-12-2010 11:05 AM |
Custom news source | JayCeeEll | Calibre | 2 | 11-14-2009 04:01 AM |