Skip to content

Commit 6608cf1

Browse files
committed
lightly init
1 parent 0001db4 commit 6608cf1

File tree

3 files changed

+41
-35
lines changed

3 files changed

+41
-35
lines changed

.lightly/settings.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
title = "lightly settings"
3+
4+
ports = []
5+
6+
[languages]

main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import os
2-
from dotenv import load_dotenv
3-
4-
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
5-
if os.path.exists(dotenv_path):
6-
load_dotenv(dotenv_path)
7-
8-
from rsshub import create_app
9-
10-
app = create_app('production')
1+
import os
2+
from dotenv import load_dotenv
3+
4+
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
5+
if os.path.exists(dotenv_path):
6+
load_dotenv(dotenv_path)
7+
8+
from rsshub import create_app
9+
10+
app = create_app('production')

rsshub/spiders/bjnews/channel.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
from rsshub.utils import fetch
2-
3-
domain = 'http://www.bjnews.com.cn'
4-
5-
6-
def parse(post):
7-
item = {}
8-
item['description'] = item['title'] = post.css('a::text').extract_first()
9-
item['link'] = post.css('a::attr(href)').extract_first()
10-
return item
11-
12-
13-
def ctx(category=''):
14-
r_url = f"{domain}/{category}"
15-
tree = fetch(r_url)
16-
html = tree.css('body')
17-
posts = tree.css('.list-a').css('li')
18-
channel_title = html.css('a.cur::text').extract_first().strip()
19-
return {
20-
'title': f'{channel_title} - 新京报',
21-
'link': r_url,
22-
'description': f'新京报「{channel_title}」频道新闻',
23-
'author': 'hillerliao',
24-
'items': list(map(parse, posts))
25-
}
1+
from rsshub.utils import fetch
2+
3+
domain = 'http://www.bjnews.com.cn'
4+
5+
6+
def parse(post):
7+
item = {}
8+
item['description'] = item['title'] = post.css('a::text').extract_first()
9+
item['link'] = post.css('a::attr(href)').extract_first()
10+
return item
11+
12+
13+
def ctx(category=''):
14+
r_url = f"{domain}/{category}"
15+
tree = fetch(r_url)
16+
html = tree.css('body')
17+
posts = tree.css('.list-a').css('li')
18+
channel_title = html.css('a.cur::text').extract_first().strip()
19+
return {
20+
'title': f'{channel_title} - 新京报',
21+
'link': r_url,
22+
'description': f'新京报「{channel_title}」频道新闻',
23+
'author': 'hillerliao',
24+
'items': list(map(parse, posts))
25+
}

0 commit comments

Comments
 (0)