mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
51 lines
1.8 KiB
Plaintext
51 lines
1.8 KiB
Plaintext
__license__ = 'GPL v3'
|
|
__copyright__ = '2009-2012, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
twitchfilm.net/news/
|
|
'''
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
class Twitchfilm(BasicNewsRecipe):
|
|
title = 'Twitch Films'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'Twitch specializes in spreading the news on strange little films from around the world.'
|
|
oldest_article = 30
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
encoding = 'utf-8'
|
|
publisher = 'Twitch'
|
|
category = 'twitch, twitchfilm, movie news, movie reviews, cult cinema, independent cinema, anime, foreign cinema, geek talk'
|
|
language = 'en'
|
|
|
|
conversion_options = {
|
|
'comment': description, 'tags': category, 'publisher': publisher, 'language': language
|
|
}
|
|
|
|
keep_only_tags = [dict(attrs={'class': 'entry'})]
|
|
remove_tags_after = dict(attrs={'class': 'text'})
|
|
remove_tags = [dict(name='div', attrs={'class': ['social', 'categories']}), dict(attrs={'id': 'main-asset'}), dict(name=['meta', 'link', 'iframe', 'embed', 'object']) # noqa
|
|
]
|
|
|
|
feeds = [(u'News', u'http://feeds.twitchfilm.net/TwitchEverything')]
|
|
|
|
def preprocess_html(self, soup):
|
|
for item in soup.findAll(style=True):
|
|
del item['style']
|
|
for item in soup.findAll('a'):
|
|
limg = item.find('img')
|
|
if item.string is not None:
|
|
str = item.string
|
|
item.replaceWith(str)
|
|
else:
|
|
if limg:
|
|
item.name = 'div'
|
|
item.attrs = []
|
|
else:
|
|
str = self.tag_to_string(item)
|
|
item.replaceWith(str)
|
|
for item in soup.findAll('img', alt=False):
|
|
item['alt'] = 'image'
|
|
return soup
|