Skip to content

Commit

Permalink
misc: Fix aylei#3
Browse files Browse the repository at this point in the history
  • Loading branch information
hzlinqien committed Mar 20, 2019
1 parent 0ba09bd commit 9954801
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/problem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ extern crate reqwest;

use std::fmt::{Display, Formatter, Error};

const PROBLEMS_URL: &str = "https://leetcode.com/api/problems/algorithms/";
const GRAPHQL_URL: &str = "https://leetcode.com/graphql";
const PROBLEMS_URL: &str = "https://leetcode-cn.com/api/problems/algorithms/";
const GRAPHQL_URL: &str = "https://leetcode-cn.com/graphql";
const QUESTION_QUERY_STRING: &str = r#"
query questionData($titleSlug: String!) {
question(titleSlug: $titleSlug) {
Expand All @@ -20,7 +20,7 @@ const QUESTION_QUERY_OPERATION: &str = "questionData";
pub fn get_problem(id: u32) -> Option<Problem> {
let problems = get_problems().unwrap();
for problem in problems.stat_status_pairs.iter() {
if problem.stat.question_id == id {
if problem.stat.frontend_question_id == id {
let client = reqwest::Client::new();
let resp: RawProblem = client.post(GRAPHQL_URL)
.json(&Query::question_query(problem.stat.question_title_slug.as_ref().unwrap()))
Expand Down

0 comments on commit 9954801

Please sign in to comment.