Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 修改豆瓣标题和参数描述 #4315

Merged
merged 4 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: 修改标题和参数描述
1. 标题改为带有电影人名字;
2. 参数描述中的半角括号改为全角。
  • Loading branch information
yaotj committed Mar 24, 2020
commit 5c1b0721713957a45617e315230a5d97b3185615
2 changes: 1 addition & 1 deletion docs/social-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性

### 豆瓣电影人

<Route author="minimalistrojan" example="/douban/celebrity/1274261" path="/douban/celebrity/:id/:sort?" :paramsDesc="['电影人 id', '排序方式,缺省为 `time` (时间排序),可为 `vote` (评价排序)']"/>
<Route author="minimalistrojan" example="/douban/celebrity/1274261" path="/douban/celebrity/:id/:sort?" :paramsDesc="['电影人 id', '排序方式,缺省为 `time`时间排序,可为 `vote` 评价排序']"/>

### 豆瓣小组

Expand Down
5 changes: 4 additions & 1 deletion lib/routes/douban/celebrity.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ module.exports = async (ctx) => {

const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
const list = $('div.grid_view > ul li'); // 使用 cheerio 选择器
const person = $('#content > h1')
.text()
.replace(/的全部作品(\d{1,})/, '');
let itemPicUrl;

ctx.state.data = {
title: '豆瓣电影-电影人作品',
title: `豆瓣电影人 - ${person}`,
link: `https://movie.douban.com/celebrity/${id}/movies?sortby=${sort}`,
item:
list &&
Expand Down