diff --git a/lib/plugins/leetcode.js b/lib/plugins/leetcode.js index c403582d..c66d7cfc 100644 --- a/lib/plugins/leetcode.js +++ b/lib/plugins/leetcode.js @@ -534,15 +534,9 @@ plugin.login = function(user, cb) { }; function parseCookie(cookie, body, cb) { - const isCN = config.app === 'leetcode.cn'; const SessionPattern = /LEETCODE_SESSION=(.+?)(;|$)/; - let csrfPattern; - if (isCN) { - csrfPattern = /name="csrfmiddlewaretoken" value="(.*?)"/; - } else { - csrfPattern = /csrftoken=(.+?)(;|$)/; - } - const reCsrfResult = csrfPattern.exec(isCN? body: cookie); + const csrfPattern = /csrftoken=(.+?)(;|$)/; + const reCsrfResult = csrfPattern.exec(cookie); const reSessionResult = SessionPattern.exec(cookie); if (reSessionResult === null || reCsrfResult === null) { return cb('invalid cookie?');