Skip to content

Commit 724a718

Browse files
committed
remove the tail spaces
1 parent 81a3fa8 commit 724a718

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

scripts/lib/query_problem.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ function get_question_slug()
1111
QUESTION_TITLE_SLUG=$(echo $QUESTION_TITLE_SLUG | sed 's/\/.*//g') # remove the needless url path
1212
}
1313

14-
function query_problem_xidel()
14+
function query_problem_xidel()
1515
{
1616
# xidel change the -q option to -s after 0.9.4 version, so we have to check that
17-
# if xidel has -q option, then it will return error.
17+
# if xidel has -q option, then it will return error.
1818

1919
OPT=
2020

@@ -23,12 +23,12 @@ function query_problem_xidel()
2323
if [ $? -ne 0 ]; then
2424
OPT=-q
2525
else
26-
# if xidel has -s option, then it will return error.
26+
# if xidel has -s option, then it will return error.
2727
xidel -s 2>/dev/null
2828
if [ $? -ne 0 ]; then
2929
OPT=-s
3030
fi
31-
fi
31+
fi
3232
set -e
3333

3434
QUESTION_CONTENT=$(xidel ${OPT} ${TMP_JSON_FILE} -e '$json("data").question.content' | sed -e 's/<[^>]*>//g; s/&nbsp;/ /g; s/&amp;/\&/g; s/&lt;/\</g; s/&gt;/\>/g; s/&quot;/\"/g; s/&#39;/\'"'"'/g; s/&ldquo;/\"/g;')
@@ -41,10 +41,10 @@ function query_problem_xidel()
4141

4242
QUESTION_FRONTEND_ID=$(xidel ${OPT} ${TMP_JSON_FILE} -e '$json("data").question.questionFrontendId')
4343

44-
#QUESTION_CATEGORY=$(xidel ${OPT} ${TMP_JSON_FILE} -e '$json("data").question.categoryTitle')
44+
#QUESTION_CATEGORY=$(xidel ${OPT} ${TMP_JSON_FILE} -e '$json("data").question.categoryTitle')
4545
}
4646

47-
function query_problem_jq()
47+
function query_problem_jq()
4848
{
4949
QUESTION_CONTENT=$(jq -r '.data.question.content' ${TMP_JSON_FILE} | sed -e 's/<sup>/\^/g' | sed -e 's/<[^>]*>//g; s/&nbsp;/ /g; s/&amp;/\&/g; s/&lt;/\</g; s/&gt;/\>/g; s/&quot;/\"/g; s/&#39;/\'"'"'/g; s/&ldquo;/\"/g;')
5050

@@ -55,17 +55,17 @@ function query_problem_jq()
5555
QUESTION_ID=$(jq -r '.data.question.questionId' ${TMP_JSON_FILE})
5656

5757
QUESTION_FRONTEND_ID=$(jq -r '.data.question.questionFrontendId' ${TMP_JSON_FILE})
58-
58+
5959
}
6060

6161
function query_problem()
6262
{
6363
TMP_JSON_FILE=tmp.json
6464

65-
# curl -s "https://leetcode.com/graphql?query=query%20getQuestionDetail(%24titleSlug%3A%20String!)%20%7B%0A%20%20isCurrentUserAuthenticated%0A%20%20question(titleSlug%3A%20%24titleSlug)%20%7B%0A%20%20%20%20questionId%0A%20%20%20%20questionFrontendId%0A%20%20%20%20questionTitle%0A%20%20%20%20translatedTitle%0A%20%20%20%20questionTitleSlug%0A%20%20%20%20content%0A%20%20%20%20translatedContent%0A%20%20%20%20difficulty%0A%20%20%20%20stats%0A%20%20%20%20contributors%0A%20%20%20%20similarQuestions%0A%20%20%20%20discussUrl%0A%20%20%20%20mysqlSchemas%0A%20%20%20%20randomQuestionUrl%0A%20%20%20%20sessionId%0A%20%20%20%20categoryTitle%0A%20%20%20%20submitUrl%0A%20%20%20%20interpretUrl%0A%20%20%20%20codeDefinition%0A%20%20%20%20sampleTestCase%0A%20%20%20%20enableTestMode%0A%20%20%20%20metaData%0A%20%20%20%20enableRunCode%0A%20%20%20%20enableSubmit%0A%20%20%20%20judgerAvailable%0A%20%20%20%20infoVerified%0A%20%20%20%20envInfo%0A%20%20%20%20urlManager%0A%20%20%20%20article%0A%20%20%20%20questionDetailUrl%0A%20%20%20%20discussCategoryId%0A%20%20%20%20discussSolutionCategoryId%0A%20%20%20%20libraryUrl%0A%20%20%20%20companyTags%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20slug%0A%20%20%20%20%20%20translatedName%0A%20%20%20%20%7D%0A%20%20%20%20topicTags%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20slug%0A%20%20%20%20%20%20translatedName%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20interviewed%20%7B%0A%20%20%20%20interviewedUrl%0A%20%20%20%20companies%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20slug%0A%20%20%20%20%7D%0A%20%20%20%20timeOptions%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%20%20stageOptions%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20subscribeUrl%0A%20%20isPremium%0A%20%20loginUrl%0A%7D%0A&operationName=getQuestionDetail&variables=%7B%22titleSlug%22%3A%22${2}%22%7D" > ${TMP_JSON_FILE}
65+
# curl -s "https://leetcode.com/graphql?query=query%20getQuestionDetail(%24titleSlug%3A%20String!)%20%7B%0A%20%20isCurrentUserAuthenticated%0A%20%20question(titleSlug%3A%20%24titleSlug)%20%7B%0A%20%20%20%20questionId%0A%20%20%20%20questionFrontendId%0A%20%20%20%20questionTitle%0A%20%20%20%20translatedTitle%0A%20%20%20%20questionTitleSlug%0A%20%20%20%20content%0A%20%20%20%20translatedContent%0A%20%20%20%20difficulty%0A%20%20%20%20stats%0A%20%20%20%20contributors%0A%20%20%20%20similarQuestions%0A%20%20%20%20discussUrl%0A%20%20%20%20mysqlSchemas%0A%20%20%20%20randomQuestionUrl%0A%20%20%20%20sessionId%0A%20%20%20%20categoryTitle%0A%20%20%20%20submitUrl%0A%20%20%20%20interpretUrl%0A%20%20%20%20codeDefinition%0A%20%20%20%20sampleTestCase%0A%20%20%20%20enableTestMode%0A%20%20%20%20metaData%0A%20%20%20%20enableRunCode%0A%20%20%20%20enableSubmit%0A%20%20%20%20judgerAvailable%0A%20%20%20%20infoVerified%0A%20%20%20%20envInfo%0A%20%20%20%20urlManager%0A%20%20%20%20article%0A%20%20%20%20questionDetailUrl%0A%20%20%20%20discussCategoryId%0A%20%20%20%20discussSolutionCategoryId%0A%20%20%20%20libraryUrl%0A%20%20%20%20companyTags%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20slug%0A%20%20%20%20%20%20translatedName%0A%20%20%20%20%7D%0A%20%20%20%20topicTags%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20slug%0A%20%20%20%20%20%20translatedName%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20interviewed%20%7B%0A%20%20%20%20interviewedUrl%0A%20%20%20%20companies%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20slug%0A%20%20%20%20%7D%0A%20%20%20%20timeOptions%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%20%20stageOptions%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20subscribeUrl%0A%20%20isPremium%0A%20%20loginUrl%0A%7D%0A&operationName=getQuestionDetail&variables=%7B%22titleSlug%22%3A%22${2}%22%7D" > ${TMP_JSON_FILE}
6666

6767
#
68-
# NOTE: leetcode server supports `br` encoding and make it high priority. But curl doesn't support it,
68+
# NOTE: leetcode server supports `br` encoding and make it high priority. But curl doesn't support it,
6969
# So, you need make sure the `accept-encoding` hasn't br in the request header.
7070
# (if you copy & paste the curl script from Chrome, the `br` could be added!)
7171
#
@@ -100,7 +100,7 @@ function detect_os()
100100
echo ${platform}
101101
}
102102

103-
function install_brew()
103+
function install_brew()
104104
{
105105
TRUE_CMD=`which true`
106106
brew=`type -P brew || ${TRUE_CMD}`
@@ -115,10 +115,10 @@ function manually_install_jq() {
115115
echo "Unknown platform, please install 'jq' manually!"
116116
echo "Dowload Site: https://stedolan.github.io/jq/download/"
117117
}
118-
function install_jq()
118+
function install_jq()
119119
{
120120
echo "Install jq ..."
121-
121+
122122
platform=`detect_os`
123123

124124
if [[ "$platform" == "unknown" ]]; then
@@ -139,7 +139,7 @@ function install_jq()
139139
;;
140140
CentOS* ) echo sudo yum install jq
141141
;;
142-
* ) manually_install_jq
142+
* ) manually_install_jq
143143
exit 1;
144144
esac
145145
fi

0 commit comments

Comments
 (0)