Skip to content

Commit d616bbc

Browse files
committed
stop if cant fetch leetcode_id
1 parent d4e1cb6 commit d616bbc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

skeleton.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ if [ -z "$leetcode_name" ]; then
77
exit;
88
fi
99

10-
info=`curl -s https://leetcode.com/problemset/algorithms/ | grep $leetcode_name -B 2`
10+
info=`curl -s https://leetcode.com/problemset/algorithms/ | grep /$leetcode_name/ -B 2`
1111
IFS=
1212
leetcode_id=`(sed 's/<td>\\(.*\\)<\\/td>/\\1/' | sed 's/^ *//') < <(echo $info | head -n 1)`
1313
title=`(sed 's/<a.*>\\(.*\\)<\\/a>/\\1/' | sed 's/^ *//') < <(echo $info | tail -n 1)`
1414

15+
if [ -z "$leetcode_id" ]; then
16+
echo "cant fetch leetcode_id for $leetcode_name"
17+
exit
18+
fi
19+
1520
now=`date --rfc-3339=seconds`
1621

1722
mkdir -p $leetcode_name

0 commit comments

Comments
 (0)