Skip to content

Commit 9cac346

Browse files
committed
feat: support search music
1 parent 035f8ac commit 9cac346

File tree

7 files changed

+16
-6
lines changed

7 files changed

+16
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
因为网上找到的大多数豆瓣的 workflow 都因为豆瓣 api 的关闭而失效,所以,自己动手,丰衣足食。
44

5-
支持搜索书籍以及电影
5+
支持搜索书籍、电影和音乐
66

7-
分别使用 `dbb` (douban book 简称)与 `dbm`(douban movie 简称)
7+
`dbb` (douban book 简称)
8+
`dbm`(douban movie 简称)
9+
`dby`(douban yinyue简称,与dbm冲突,折衷)
810

911
### 安装
1012

@@ -16,12 +18,14 @@
1618

1719
![image-20181121210659883](./assert/image-20181121210659883.png)
1820

21+
![music](./assert/music.png)
22+
1923
### 遗憾的地方
2024

21-
可以使用书籍或者电影的缩略图代替 emoji 的图像,但是 alfred 的 workflow 默认不支持加载网络资源。so,just forget it。
25+
可以使用书籍、电影和音乐的缩略图代替 emoji 的图像,但是 alfred 的 workflow 默认不支持加载网络资源。so,just forget it。
2226

2327

2428

2529
### 最后
2630

27-
欢迎 pr。
31+
欢迎 pr。

assert/music.png

269 KB
Loading

douban-workflow

-505 KB
Binary file not shown.

douban.alfredworkflow

-113 KB
Binary file not shown.

douban.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7+
"os"
8+
"strings"
9+
710
"github.com/PuerkitoBio/goquery"
811
"golang.org/x/net/html"
912
"gopkg.in/resty.v1"
10-
"os"
11-
"strings"
1213
)
1314

1415
type UrlItem struct {
@@ -43,6 +44,10 @@ var urlMapping = map[string]UrlItem{
4344
Url: "https://m.douban.com/search/?type=movie&query=%s",
4445
Cat: "1002",
4546
},
47+
"music": {
48+
Url: "https://m.douban.com/search/?type=music&query=%s",
49+
Cat: "1003",
50+
},
4651
}
4752

4853
func getNodeAttr(node *html.Node, attrName string) string {

imgs/music.png

29.8 KB
Loading

0 commit comments

Comments
 (0)