diff options
author | clarkzjw <[email protected]> | 2018-01-11 20:54:06 +0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2018-01-11 20:54:06 +0800 |
commit | 866436c73338c2d0caa0cb35dff4949048943fee (patch) | |
tree | 7c8a37f83f755c7badd982d1bb2f950c40556393 | |
parent | 78760ab08d1d2ca51004934ac8ff690be38fd7ce (diff) | |
download | blog.jinwei.me-866436c73338c2d0caa0cb35dff4949048943fee.tar.gz |
+ add rss
-rw-r--r-- | Dockerfile | 2 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | _posts/2017/12/movies.rst | 2 | ||||
-rw-r--r-- | rss.py | 15 | ||||
-rw-r--r-- | rss.xml | 94 |
5 files changed, 105 insertions, 13 deletions
@@ -14,7 +14,7 @@ ADD . /app | |||
14 | 14 | ||
15 | WORKDIR /app | 15 | WORKDIR /app |
16 | 16 | ||
17 | RUN /bin/bash -c "source /app/.venv/bin/activate && make html" | 17 | RUN /bin/bash -c "source /app/.venv/bin/activate && make html && make rss" |
18 | 18 | ||
19 | 19 | ||
20 | FROM alpine:latest | 20 | FROM alpine:latest |
@@ -12,9 +12,12 @@ BUILDDIR = _build | |||
12 | help: | 12 | help: |
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
14 | 14 | ||
15 | rss: | ||
16 | python rss.py > rss.xml | ||
17 | |||
15 | .PHONY: help Makefile | 18 | .PHONY: help Makefile |
16 | 19 | ||
17 | # Catch-all target: route all unknown targets to Sphinx using the new | 20 | # Catch-all target: route all unknown targets to Sphinx using the new |
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | 21 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). |
19 | %: Makefile | 22 | %: Makefile |
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file | 23 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
diff --git a/_posts/2017/12/movies.rst b/_posts/2017/12/movies.rst index 94ecee5..6be761d 100644 --- a/_posts/2017/12/movies.rst +++ b/_posts/2017/12/movies.rst | |||
@@ -6,7 +6,7 @@ | |||
6 | 2017观影记录 | 6 | 2017观影记录 |
7 | =================== | 7 | =================== |
8 | 8 | ||
9 | :Publish Date: 2010-01-01 | 9 | :Publish Date: 2017-12-30 |
10 | 10 | ||
11 | 2017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。 | 11 | 2017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。 |
12 | 12 | ||
@@ -26,12 +26,6 @@ def render_template(cwd, template_path, context): | |||
26 | return env.get_template(template_path).render(context) | 26 | return env.get_template(template_path).render(context) |
27 | 27 | ||
28 | 28 | ||
29 | def _remove_attrs(soup): | ||
30 | for tag in soup.findAll(True): | ||
31 | tag.attrs = None | ||
32 | return soup | ||
33 | |||
34 | |||
35 | def main(): | 29 | def main(): |
36 | 30 | ||
37 | filenames = glob.glob("./_build/html/_posts/*/*/*.html") | 31 | filenames = glob.glob("./_build/html/_posts/*/*/*.html") |
@@ -41,11 +35,12 @@ def main(): | |||
41 | 35 | ||
42 | for p in filenames: | 36 | for p in filenames: |
43 | soup = BeautifulSoup(open(p), "html5lib") | 37 | soup = BeautifulSoup(open(p), "html5lib") |
44 | body = soup.find_all("div", class_="body") | 38 | body = soup.find_all("div", class_="body")[0].text |
39 | |||
45 | posts.append({ | 40 | posts.append({ |
46 | "title": soup.title.string, | 41 | "title": soup.title.string, |
47 | "body": body[0].text, | 42 | "body": body, |
48 | "date_rss": "", | 43 | "date_rss": body[body.find("Publish Date:")+13:body.find("Publish Date:")+23], |
49 | "permalink": "/".join(p.split("/")[3:]) | 44 | "permalink": "/".join(p.split("/")[3:]) |
50 | }) | 45 | }) |
51 | 46 | ||
@@ -53,7 +48,7 @@ def main(): | |||
53 | "site": { | 48 | "site": { |
54 | "name": "Hello World", | 49 | "name": "Hello World", |
55 | "url": "https://blog.jinwei.me", | 50 | "url": "https://blog.jinwei.me", |
56 | "tagline": "Freedom is my birthright and I shall have it." | 51 | "tagline": "Freedom is my birth right and I shall have it." |
57 | }, | 52 | }, |
58 | "posts": posts | 53 | "posts": posts |
59 | } | 54 | } |
@@ -0,0 +1,94 @@ | |||
1 | ['./_build/html/_posts/2017/12/movies.html'] | ||
2 | <?xml version="1.0" encoding="UTF-8"?> | ||
3 | <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | ||
4 | <channel> | ||
5 | <title>Hello World</title> | ||
6 | <link>https://blog.jinwei.me</link> | ||
7 | <description>Freedom is my birth right and I shall have it.</description> | ||
8 | <atom:link href="https://blog.jinwei.me/rss" rel="self" type="application/rss+xml" /> | ||
9 | |||
10 | <item> | ||
11 | <title>2017观影记录 — Hello World</title> | ||
12 | <description> | ||
13 | |||
14 | |||
15 | 2017观影记录¶ | ||
16 | |||
17 | |||
18 | |||
19 | |||
20 | Publish Date:2010-01-01 | ||
21 | |||
22 | |||
23 | |||
24 | 2017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。 | ||
25 | 线下电影院观影记录(按时间顺序,以中国大陆上映时的片名为准): | ||
26 | |||
27 | 星球大战外传:侠盗一号 (Rogue One: A Star Wars Story) | ||
28 | 太空旅客 (Passengers) | ||
29 | 降临 (Arrival) | ||
30 | 极限特工:终极回归 (xXx: The Return of Xander Cage) | ||
31 | 生化危机6:终章 (Resident Evil: The Final Chapter) | ||
32 | 金刚狼3:殊死一战 (Logan) | ||
33 | 攻壳机动队 (Ghost in the Shell) | ||
34 | 速度与激情8 (The Fate of the Furious) | ||
35 | 拆弹专家 | ||
36 | 大护法 | ||
37 | 战狼2 | ||
38 | 星际特工:千星之城 (Valérian et la Cité des mille planètes) | ||
39 | 看不见的客人 (Contratiempo) | ||
40 | 英伦对决 (The Foreigner) | ||
41 | 天才枪手 (ฉลาดเกมส์โกง) | ||
42 | 王牌特工2:黄金圈 (Kingsman: The Golden Circle) | ||
43 | 全球风暴 (Geostorm) | ||
44 | 东方快车谋杀案 (Murder on the Orient Express) | ||
45 | 雷神3:诸神黄昏 (Thor: Ragnarok) | ||
46 | 追捕 | ||
47 | 至暗时刻 (Darkest Hour) | ||
48 | 寻梦环游记 (Coco) | ||
49 | 至爱梵高·星空之谜 (Loving Vincent) | ||
50 | 芳华 | ||
51 | |||
52 | 线上观影记录(包括BT下载以及Netflix,包括电影/纪录片/部分美剧,不完全): | ||
53 | |||
54 | Blade Runner (1982) | ||
55 | Blade Runner 2049 | ||
56 | Love Actually | ||
57 | World War Z | ||
58 | Dunkirk | ||
59 | Everst | ||
60 | 霸王别姬 | ||
61 | Titanic | ||
62 | 隧道 (터널) | ||
63 | London Has Fallen | ||
64 | 出租车司机 (택시운전사) | ||
65 | Ocean’s Eleven | ||
66 | Ocean’s Twelve | ||
67 | Shooter | ||
68 | Knight Day | ||
69 | 2001: A Space Odyssey | ||
70 | Minority Report | ||
71 | Deep Impact | ||
72 | Area 51 | ||
73 | San Andreas | ||
74 | I, Origin | ||
75 | Particle Fever | ||
76 | City 40 | ||
77 | Stranger Things | ||
78 | House Of Cards, Season 1 | ||
79 | |||
80 | 现在回忆一下,很多电影的质量其实很一般,属于看完之后走出电影院差不多就能忘记剧情的那种。这种电影很多都是所谓的「商业大片」,追求特效和画面,完全不考虑剧情的质量和观众的观影感受。 | ||
81 | 简单分析了一下,线下观影的统计 | ||
82 | |||
83 | 6月居然一部都没看,是因为工作太饱和了还是因为没有好看的电影呢? | ||
84 | |||
85 | |||
86 | |||
87 | </description> | ||
88 | <pubDate>2010-01-01</pubDate> | ||
89 | <link>https://blog.jinwei.me/_posts/2017/12/movies.html</link> | ||
90 | <guid isPermaLink="true">https://blog.jinwei.me/_posts/2017/12/movies.html</guid> | ||
91 | </item> | ||
92 | |||
93 | </channel> | ||
94 | </rss> | ||