Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support translatedContent test on leetcode-cn.com #98

Merged
merged 1 commit into from
May 23, 2018
Merged

support translatedContent test on leetcode-cn.com #98

merged 1 commit into from
May 23, 2018

Conversation

EINDEX
Copy link
Contributor

@EINDEX EINDEX commented May 14, 2018

image
#93

@@ -137,6 +137,7 @@ plugin.getProblem = function(problem, cb) {
' sampleTestCase',
' enableRunCode',
' metaData',
' translatedContent',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EINDEX!

I assume that this new field would work for both leetcode.com and leetcode-cn.com?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the problems doesn't have chinese in leetcode-cn.com like this sum-of-distances-in-tree. The tranlatedContent filed is null.

if (!q.translatedContent) {
problem.desc = he.decode(cheerio.load(q.content).root().text());
}else{
problem.desc = he.decode(cheerio.load(q.translatedContent).root().text());
Copy link
Owner

@skygragon skygragon May 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could combine into single line like:

problem.desc = he.decode(cheerio.load(q.translatedContent || q.content).root().text());

Assume that q.translatedContent would be null if talking with leetcode.com.

@skygragon skygragon merged commit bb09530 into skygragon:master May 23, 2018
15cm pushed a commit to 15cm/leetcode-cli that referenced this pull request Jun 13, 2018
support translatedContent test on leetcode-cn.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants