View Single Post
Old 07-04-2020, 09:51 AM   #4
umfu
Junior Member
umfu began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2017
Device: kindle
A below is my recipe.

from calibre.web.feeds.news import BasicNewsRecipe

testUrl = 'https://www.hbrkorea.com/article/pop_print/article_no/1566/atype/ma'
class HBRkroeaTest(BasicNewsRecipe):

def __init__(self, *args, **kwargs):
BasicNewsRecipe.__init__(self, *args, **kwargs)
if self.output_profile.short_name.startswith('kindle' ):
# Reduce image sizes to get file size below amazon's email
# sending threshold
self.web2disk_options.compress_news_images = True
self.web2disk_options.compress_news_images_auto_si ze = 5
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')

def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
LoginUrl = 'https://www.hbrkorea.com/member/login?re_url=/'
br.open(LoginUrl)
br.select_form(name='login_form')
br['email'] = ID
br['password'] = PASSWORD
br.submit()

return br

def parse_index(self):
Article=[]
Article.append({'title':'test','url':testUrl})
feeds=[('name',Article)]

return feeds
umfu is offline   Reply With Quote