File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,19 @@ def camel_to_snake(camel_case_string):
11
11
data = json .loads (data )
12
12
result = []
13
13
for item in data :
14
- # ValidAnagram
15
14
if sys .argv [1 ].isalpha () and camel_to_snake (sys .argv [1 ]) in item ["arg" ]:
16
15
pass
17
16
elif sys .argv [1 ].lower () not in item ["title" ].lower ():
18
17
continue
19
18
if os .environ ['alfred_workflow_keyword' ].lower () == "lc" :
20
19
item ["arg" ] = f"https://leetcode.cn/problems/{ item ['arg' ]} /description/"
21
20
else :
22
- item ["arg" ] = f"https://www.google.com.hk/search?&q=site:programmercarl.com+{ item ['title' ]} "
21
+ parts = item ['title' ].split (' ' )
22
+ text = '' .join (parts [1 :]).replace (' ' , '' )
23
+ formatted_title = '{:0>4}.{}.html' .format (parts [0 ], text )
24
+ item ["arg" ] = f"https://programmercarl.com/{ formatted_title } "
23
25
item ["icon" ] = {}
24
26
item ["icon" ]["path" ] = "icon.png"
25
27
result .append (item )
26
28
alfredJSON = json .dumps ({"items" : result }, indent = 2 , ensure_ascii = False )
27
- sys .stdout .write (alfredJSON )
29
+ sys .stdout .write (alfredJSON )
You can’t perform that action at this time.
0 commit comments