Skip to content

Commit

Permalink
feat: support search for jd
Browse files Browse the repository at this point in the history
  • Loading branch information
MuYunyun committed Nov 23, 2021
1 parent d14faf3 commit 687f827
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 31 deletions.
Binary file added CF658493-2BBB-4571-A332-86BFBCCB5AFB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [搜索](#搜索)
- [知乎智能搜索匹配](#知乎智能搜索匹配)
- [淘宝智能搜索匹配](#淘宝智能搜索匹配)
- [京东智能搜索匹配](#京东智能搜索匹配)
- [掘金智能搜索匹配](#掘金智能搜索匹配)
- [Github 智能搜索匹配](#github-智能搜索匹配)
- [工作流提效](#工作流提效)
Expand Down Expand Up @@ -32,6 +33,12 @@

![](http://with.muyunyun.cn/97f9f0513c1369886a812bbf6cd73b05.jpg-400)

### 京东智能搜索匹配

* 触发 key : `jd`

![](http://with.muyunyun.cn/19e5ecbc5d38251e5ceeb145579faeb1.jpg-400)

### 掘金智能搜索匹配

* 触发 key : `gold`, 按住 `cmd` 可以查看内容简介
Expand Down
Binary file modified flow.alfredworkflow
Binary file not shown.
138 changes: 107 additions & 31 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@
<false/>
</dict>
</array>
<key>CF658493-2BBB-4571-A332-86BFBCCB5AFB</key>
<array>
<dict>
<key>destinationuid</key>
<string>259A5907-9A8C-4B24-A85E-B11FDC01D311</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>E73DE4F3-55ED-4D4A-B407-28EFDC650B17</key>
<array>
<dict>
Expand Down Expand Up @@ -247,6 +260,55 @@
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttreatemptyqueryasnil</key>
<false/>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>127</integer>
<key>keyword</key>
<string>jd</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Searching... Please Wait</string>
<key>script</key>
<string>./node_modules/.bin/run-node search.js jd "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>Input keywords to search in jd</string>
<key>title</key>
<string>搜索</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>CF658493-2BBB-4571-A332-86BFBCCB5AFB</string>
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -735,6 +797,7 @@ fi</string>
- [搜索](#搜索)
- [知乎智能搜索匹配](#知乎智能搜索匹配)
- [淘宝智能搜索匹配](#淘宝智能搜索匹配)
- [京东智能搜索匹配](#京东智能搜索匹配)
- [掘金智能搜索匹配](#掘金智能搜索匹配)
- [Github 智能搜索匹配](#github-智能搜索匹配)
- [工作流提效](#工作流提效)
Expand Down Expand Up @@ -763,6 +826,12 @@ fi</string>
![](http://with.muyunyun.cn/97f9f0513c1369886a812bbf6cd73b05.jpg-400)
### 京东智能搜索匹配
* 触发 key : `jd`
![](http://with.muyunyun.cn/19e5ecbc5d38251e5ceeb145579faeb1.jpg-400)
### 掘金智能搜索匹配
* 触发 key : `gold`, 按住 `cmd` 可以查看内容简介
Expand Down Expand Up @@ -806,113 +875,120 @@ fi</string>
<key>03DBE303-E9DD-4A57-B051-C440279CF378</key>
<dict>
<key>xpos</key>
<integer>95</integer>
<integer>65</integer>
<key>ypos</key>
<integer>515</integer>
<integer>695</integer>
</dict>
<key>0A1F8331-941F-436E-B246-33278755D60A</key>
<dict>
<key>xpos</key>
<integer>230</integer>
<integer>60</integer>
<key>ypos</key>
<integer>30</integer>
<integer>35</integer>
</dict>
<key>17C80585-EC4F-498F-AB91-DBA6EBEA4C9D</key>
<dict>
<key>xpos</key>
<integer>90</integer>
<integer>65</integer>
<key>ypos</key>
<integer>270</integer>
<integer>430</integer>
</dict>
<key>258D642D-325C-41B4-A42D-465A99642478</key>
<dict>
<key>xpos</key>
<integer>265</integer>
<integer>235</integer>
<key>ypos</key>
<integer>660</integer>
<integer>840</integer>
</dict>
<key>259A5907-9A8C-4B24-A85E-B11FDC01D311</key>
<dict>
<key>xpos</key>
<integer>440</integer>
<integer>460</integer>
<key>ypos</key>
<integer>200</integer>
<integer>295</integer>
</dict>
<key>29EFA025-C5F1-468D-B065-59EF0C026D11</key>
<dict>
<key>xpos</key>
<integer>230</integer>
<integer>65</integer>
<key>ypos</key>
<integer>380</integer>
<integer>560</integer>
</dict>
<key>4C4E518D-0498-4D93-B09C-549A95C44A7D</key>
<dict>
<key>xpos</key>
<integer>460</integer>
<integer>430</integer>
<key>ypos</key>
<integer>810</integer>
<integer>990</integer>
</dict>
<key>62AC894E-3015-44DC-96BC-313D1622A652</key>
<dict>
<key>xpos</key>
<integer>270</integer>
<integer>240</integer>
<key>ypos</key>
<integer>810</integer>
<integer>990</integer>
</dict>
<key>80F67126-8A71-4268-95E8-6BC8B87A976C</key>
<dict>
<key>xpos</key>
<integer>435</integer>
<integer>405</integer>
<key>ypos</key>
<integer>515</integer>
<integer>695</integer>
</dict>
<key>99005792-A935-48B8-A8E6-B02B9423ACBD</key>
<dict>
<key>xpos</key>
<integer>95</integer>
<integer>65</integer>
<key>ypos</key>
<integer>810</integer>
<integer>990</integer>
</dict>
<key>AC03358E-EAF7-48F0-A86A-951E4AD07CBC</key>
<dict>
<key>xpos</key>
<integer>265</integer>
<integer>235</integer>
<key>ypos</key>
<integer>515</integer>
<integer>695</integer>
</dict>
<key>AD7F82B8-51F1-4A5A-89DE-7CE2D2A6E369</key>
<dict>
<key>xpos</key>
<integer>95</integer>
<integer>65</integer>
<key>ypos</key>
<integer>840</integer>
</dict>
<key>CF658493-2BBB-4571-A332-86BFBCCB5AFB</key>
<dict>
<key>xpos</key>
<integer>60</integer>
<key>ypos</key>
<integer>660</integer>
<integer>295</integer>
</dict>
<key>D9E0CF4E-F639-4FEB-8ECB-9B6CA14A7131</key>
<dict>
<key>xpos</key>
<integer>265</integer>
<integer>240</integer>
<key>ypos</key>
<integer>950</integer>
<integer>1140</integer>
</dict>
<key>E73DE4F3-55ED-4D4A-B407-28EFDC650B17</key>
<dict>
<key>xpos</key>
<integer>95</integer>
<integer>70</integer>
<key>ypos</key>
<integer>950</integer>
<integer>1140</integer>
</dict>
<key>E8F85589-F67A-4DC4-A472-E781462F41BF</key>
<dict>
<key>xpos</key>
<integer>90</integer>
<integer>60</integer>
<key>ypos</key>
<integer>140</integer>
<integer>165</integer>
</dict>
</dict>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.3.0</string>
<string>0.4.0</string>
<key>webaddress</key>
<string>https://github.com/MuYunyun/flow</string>
</dict>
Expand Down
19 changes: 19 additions & 0 deletions search.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const options = {
// host: 'search-merger-ms.juejin.im',
// path: '/v1/search?query=' + encodeURI(keyword) + '&page=0&raw_result=false&src=web'
// },
'jd': {
host: 'dd-search.jd.com',
path: '/?ver=2&key=' + encodeURI(keyword),
headers: { 'Referer': 'https://www.jd.com/' },
url: 'https://search.jd.com/Search?enc=utf-8&keyword='
},
'juejin': {
hostname: 'web-api.juejin.im',
method: 'post',
Expand Down Expand Up @@ -152,6 +158,19 @@ if (item === 'zhihu') {
}
showItem(result_array)
})
} else if (item === 'jd') {
getData((jsonContent) => {
for (let i = 0; i < jsonContent.length; i++) {
result_array.push({
title: jsonContent[i].keyword,
arg: `${options.url}${jsonContent[i].keyword}`,
icon: {
path: join(__dirname, '/CF658493-2BBB-4571-A332-86BFBCCB5AFB.png'),
},
})
}
showItem(result_array)
})
} else if (item === 'juejin') {
getJueJin((jsonContent) => {
const result = jsonContent.data.search.edges;
Expand Down

0 comments on commit 687f827

Please sign in to comment.