From 866436c73338c2d0caa0cb35dff4949048943fee Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Thu, 11 Jan 2018 20:54:06 +0800 Subject: + add rss --- Dockerfile | 2 +- Makefile | 5 ++- _posts/2017/12/movies.rst | 2 +- rss.py | 15 +++----- rss.xml | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 rss.xml diff --git a/Dockerfile b/Dockerfile index be6aae8..9560268 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ADD . /app WORKDIR /app -RUN /bin/bash -c "source /app/.venv/bin/activate && make html" +RUN /bin/bash -c "source /app/.venv/bin/activate && make html && make rss" FROM alpine:latest diff --git a/Makefile b/Makefile index 6a109aa..223cadf 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,12 @@ BUILDDIR = _build help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +rss: + python rss.py > rss.xml + .PHONY: help Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(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 @@ 2017观影记录 =================== -:Publish Date: 2010-01-01 +:Publish Date: 2017-12-30 2017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。 diff --git a/rss.py b/rss.py index faa004c..fdf4b53 100644 --- a/rss.py +++ b/rss.py @@ -26,12 +26,6 @@ def render_template(cwd, template_path, context): return env.get_template(template_path).render(context) -def _remove_attrs(soup): - for tag in soup.findAll(True): - tag.attrs = None - return soup - - def main(): filenames = glob.glob("./_build/html/_posts/*/*/*.html") @@ -41,11 +35,12 @@ def main(): for p in filenames: soup = BeautifulSoup(open(p), "html5lib") - body = soup.find_all("div", class_="body") + body = soup.find_all("div", class_="body")[0].text + posts.append({ "title": soup.title.string, - "body": body[0].text, - "date_rss": "", + "body": body, + "date_rss": body[body.find("Publish Date:")+13:body.find("Publish Date:")+23], "permalink": "/".join(p.split("/")[3:]) }) @@ -53,7 +48,7 @@ def main(): "site": { "name": "Hello World", "url": "https://blog.jinwei.me", - "tagline": "Freedom is my birthright and I shall have it." + "tagline": "Freedom is my birth right and I shall have it." }, "posts": posts } diff --git a/rss.xml b/rss.xml new file mode 100644 index 0000000..6e8bbcd --- /dev/null +++ b/rss.xml @@ -0,0 +1,94 @@ +['./_build/html/_posts/2017/12/movies.html'] + + + + Hello World + https://blog.jinwei.me + Freedom is my birth right and I shall have it. + + + + 2017观影记录 — Hello World + + + +2017观影记录¶ + + + + +Publish Date:2010-01-01 + + + +2017年马上就结束了。掐指一算,2017年看了好多电影。包括线上和线下电影院的。 +线下电影院观影记录(按时间顺序,以中国大陆上映时的片名为准): + +星球大战外传:侠盗一号 (Rogue One: A Star Wars Story) +太空旅客 (Passengers) +降临 (Arrival) +极限特工:终极回归 (xXx: The Return of Xander Cage) +生化危机6:终章 (Resident Evil: The Final Chapter) +金刚狼3:殊死一战 (Logan) +攻壳机动队 (Ghost in the Shell) +速度与激情8 (The Fate of the Furious) +拆弹专家 +大护法 +战狼2 +星际特工:千星之城 (Valérian et la Cité des mille planètes) +看不见的客人 (Contratiempo) +英伦对决 (The Foreigner) +天才枪手 (ฉลาดเกมส์โกง) +王牌特工2:黄金圈 (Kingsman: The Golden Circle) +全球风暴 (Geostorm) +东方快车谋杀案 (Murder on the Orient Express) +雷神3:诸神黄昏 (Thor: Ragnarok) +追捕 +至暗时刻 (Darkest Hour) +寻梦环游记 (Coco) +至爱梵高·星空之谜 (Loving Vincent) +芳华 + +线上观影记录(包括BT下载以及Netflix,包括电影/纪录片/部分美剧,不完全): + +Blade Runner (1982) +Blade Runner 2049 +Love Actually +World War Z +Dunkirk +Everst +霸王别姬 +Titanic +隧道 (터널) +London Has Fallen +出租车司机 (택시운전사) +Ocean’s Eleven +Ocean’s Twelve +Shooter +Knight Day +2001: A Space Odyssey +Minority Report +Deep Impact +Area 51 +San Andreas +I, Origin +Particle Fever +City 40 +Stranger Things +House Of Cards, Season 1 + +现在回忆一下,很多电影的质量其实很一般,属于看完之后走出电影院差不多就能忘记剧情的那种。这种电影很多都是所谓的「商业大片」,追求特效和画面,完全不考虑剧情的质量和观众的观影感受。 +简单分析了一下,线下观影的统计 + +6月居然一部都没看,是因为工作太饱和了还是因为没有好看的电影呢? + + + + + 2010-01-01 + https://blog.jinwei.me/_posts/2017/12/movies.html + https://blog.jinwei.me/_posts/2017/12/movies.html + + + + -- cgit v1.2.3