mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Misc recipe porting
This commit is contained in:
parent
4b0ed2ab99
commit
38686dd905
@ -4,10 +4,10 @@
|
|||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
|
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
|
from calibre import strftime
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
from calibre.ebooks.BeautifulSoup import Tag
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
@ -47,15 +47,15 @@ class DunyaHalleri(BasicNewsRecipe):
|
|||||||
|
|
||||||
extra_css = '.caption {color: #998; font-style: italic; font-size: 8pt}'
|
extra_css = '.caption {color: #998; font-style: italic; font-size: 8pt}'
|
||||||
__author__ = 'Sukru Alatas'
|
__author__ = 'Sukru Alatas'
|
||||||
feeds = [("Genel Gündem".decode('utf-8', 'replace'),
|
feeds = [(u"Genel Gündem",
|
||||||
'https://www.dunyahalleri.com/genel-gundem/feed/'),
|
'https://www.dunyahalleri.com/genel-gundem/feed/'),
|
||||||
("Teknoloji / Bilim".decode('utf-8', 'replace'),
|
(u"Teknoloji / Bilim",
|
||||||
'https://www.dunyahalleri.com/teknoloji-bilim/feed/'),
|
'https://www.dunyahalleri.com/teknoloji-bilim/feed/'),
|
||||||
("İnternet / Girişimler".decode('utf-8', 'replace'),
|
(u"İnternet / Girişimler",
|
||||||
'https://www.dunyahalleri.com/internet-girisimler/feed/'),
|
'https://www.dunyahalleri.com/internet-girisimler/feed/'),
|
||||||
("Tasarım / İnovasyon".decode('utf-8', 'replace'),
|
(u"Tasarım / İnovasyon",
|
||||||
'https://www.dunyahalleri.com/tasarim-inovasyon/feed/'),
|
'https://www.dunyahalleri.com/tasarim-inovasyon/feed/'),
|
||||||
("Kültür / Sanat".decode('utf-8', 'replace'), 'https://www.dunyahalleri.com/kultur-sanat/feed/')]
|
(u"Kültür / Sanat", 'https://www.dunyahalleri.com/kultur-sanat/feed/')]
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 50
|
max_articles_per_feed = 50
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ class DunyaHalleri(BasicNewsRecipe):
|
|||||||
|
|
||||||
# title insert
|
# title insert
|
||||||
article_title = soup.title.contents[0]
|
article_title = soup.title.contents[0]
|
||||||
article_title.replace(' - Dünya Halleri'.decode('utf-8', 'replace'), '')
|
article_title.replace(u' - Dünya Halleri', '')
|
||||||
h2 = new_tag(soup, 'h2')
|
h2 = new_tag(soup, 'h2')
|
||||||
h2.append(article_title)
|
h2.append(article_title)
|
||||||
span.insert(0, h2)
|
span.insert(0, h2)
|
||||||
@ -177,9 +177,8 @@ class DunyaHalleri(BasicNewsRecipe):
|
|||||||
|
|
||||||
def default_cover(self, cover_file):
|
def default_cover(self, cover_file):
|
||||||
title = self.title
|
title = self.title
|
||||||
date = time.strftime(
|
date = strftime('%d %B %Y')
|
||||||
'%d %B %Y').decode('utf8', 'replace')
|
author = u'www.dunyahalleri.com'
|
||||||
author = 'www.dunyahalleri.com'.decode('utf8', 'replace')
|
|
||||||
# Texts
|
# Texts
|
||||||
img = Image.new(
|
img = Image.new(
|
||||||
'RGB', (self.COVER_WIDTH, self.COVER_HEIGHT), 'white')
|
'RGB', (self.COVER_WIDTH, self.COVER_HEIGHT), 'white')
|
||||||
|
@ -243,8 +243,7 @@ class DunyaHalleri_HaftaninOzeti(BasicNewsRecipe):
|
|||||||
title = self.issue_title
|
title = self.issue_title
|
||||||
date = self.issue_date.strftime(
|
date = self.issue_date.strftime(
|
||||||
'%d %B %Y').decode('utf8', 'replace')
|
'%d %B %Y').decode('utf8', 'replace')
|
||||||
author = 'www.dunyahalleri.com/haftanin-ozeti'.decode(
|
author = u'www.dunyahalleri.com/haftanin-ozeti'
|
||||||
'utf8', 'replace')
|
|
||||||
# Texts
|
# Texts
|
||||||
img = Image.new(
|
img = Image.new(
|
||||||
'RGB', (self.COVER_WIDTH, self.COVER_HEIGHT), 'white')
|
'RGB', (self.COVER_WIDTH, self.COVER_HEIGHT), 'white')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user