|
|
#1 |
|
Enthusiast
![]() Posts: 47
Karma: 10
Join Date: Jan 2021
Location: Italy
Device: Kobo Libra 2, Kindle Paperwhite (1st gen)
|
Hi all,
some time ago I wrote a recipe for the Plane Crash Series on Medium. I recently picked it up again and improved it after gaining some knowledge of Python, and I believe I obtained a good result of extracting the main text and minimising Medium's clutter. The only thing missing that I'd like to add is a custom cover. I implemented the get_cover_url method as shown here: Code:
def get_cover_url(self):
soup = self.index_to_soup('https://admiralcloudberg.medium.com/about')
cover_url_list = []
for style in soup.find_all('style'):
for element in style:
match = re.search('https://.+?\.jpeg', element)
cover_url_list.append(match)
i = 0
while i < len(cover_url_list):
if cover_url_list[i] is not None:
cover_url = cover_url_list[i].group()
i = i+1
return cover_url
After looking at calibre's code, it seems this function does what I need, but I have no idea how to deal with files in a news recipe, particularly retrieving them and passing them along between methods. Could somebody help me with this? The full recipe is attached for reference |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comic Processing Lowers Image Resolution | Limeonade | Calibre | 1 | 04-17-2022 04:59 PM |
| Heuristic processing | saxondawg | Conversion | 6 | 01-21-2018 07:43 PM |
| Bug in Kobo processing of epub files causing hang in "Processing content" | BensonBear | Kobo Reader | 21 | 12-21-2012 05:47 AM |
| Trying to use Textile processing | getajob | Conversion | 18 | 03-09-2011 07:34 AM |
| Image processing using html2epub? | Portnull | Calibre | 2 | 06-03-2009 12:31 PM |