07-02-2020, 09:50 PM | #1 |
Junior Member
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 |
07-02-2020, 10:06 PM | #2 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
post your recipe
|
Advert | |
|
07-04-2020, 03:09 AM | #3 |
Junior Member
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. |
07-04-2020, 09:51 AM | #4 |
Junior Member
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 |
07-04-2020, 11:09 AM | #5 |
creator of calibre
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.
|
Advert | |
|
|
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 |