forked from tonywu7/feedly-link-aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtumblr.py
34 lines (25 loc) · 904 Bytes
/
tumblr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
DEPTH_LIMIT = 2
FOLLOW_DOMAINS = {'tumblr.com'}
SELECT_FEED_STATE = 'dead+'
def converter(base, match):
for scheme in ('http', 'https'):
for ending in ('rss', 'rss#_=_'):
yield f'{scheme}://{base.netloc}/{ending}'
def deactivated_converter(base, match):
for scheme in ('http', 'https'):
for ending in ('rss', 'rss#_=_'):
yield f'{scheme}://{match.group(1)}.tumblr.com/{ending}'
yield from converter(base, match)
RSS_TEMPLATES = {
r'https?://(.*)-deactivated\d*\.tumblr\.com/?.*': deactivated_converter,
r'.*\.tumblr\.com/?.*': converter,
}
TUMBLR_IGNORE = {
'www.tumblr.com', 'staff.tumblr.com', 'tumblr.com',
'engineering.tumblr.com', 'support.tumblr.com',
'assets.tumblr.com',
}
CONTRIB_SPIDER_MIDDLEWARES = {
'aggregator.contrib.filters.KeywordPrioritizer': 500,
'aggregator.contrib.tumblr.TumblrFilter': 505,
}