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 07-02-2020, 09:50 PM   #1
umfu
Junior Member
umfu began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2017
Device: kindle
can't fetch image with an unicode url

Hello,

I have tried to create my own recipe but I encountered some problem.
I could not fetch image files if it is in an unicode url.

For example, when ebook-convert try to fetch an article (https://www.hbrkorea.com/article/vie...rticle_no/1566), an error occurs, saying "could not fetch image https://www.hbrkorea.com/upload_dir/...2_표.jpg

How can I fix it?

Thanks
umfu is offline   Reply With Quote
Old 07-02-2020, 10:06 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: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
post your recipe
kovidgoyal is offline   Reply With Quote
Advert
Old 07-04-2020, 03:09 AM   #3
umfu
Junior Member
umfu began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2017
Device: kindle
Below is my test recipe.
Code:
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_size = 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

Last edited by PeterT; 07-04-2020 at 08:15 AM.
umfu is offline   Reply With Quote
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
Old 07-04-2020, 11:09 AM   #5
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: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Since that recipe seems to require a login, I cant test I'm afraid.
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image search url syntax kakkalla Apple Devices 3 07-13-2020 04:28 AM
parse image url added later in the webpage timoy_kindle Recipes 4 10-05-2016 05:18 AM
fetch article url from facebook feed knowledgecrawler Recipes 1 08-22-2014 03:07 AM
Grabbing and including image from another url Rasmus Recipes 4 07-08-2011 12:06 PM


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


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