From c835ec6f6673c03a8e9aff7ca9025b2a3f1fe1c4 Mon Sep 17 00:00:00 2001 From: Timofej Dod Date: Sat, 3 Sep 2016 21:47:02 +0300 Subject: [PATCH] Update MAL API to https, do not send score if not set in JMM (jmmclient issue 446) --- JMMServer/Constants.cs | 6 +++--- JMMServer/Providers/MyAnimeList/MALHelper.cs | 20 +++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/JMMServer/Constants.cs b/JMMServer/Constants.cs index 111c52a08..7438f3d50 100644 --- a/JMMServer/Constants.cs +++ b/JMMServer/Constants.cs @@ -148,9 +148,9 @@ public struct EpisodeDisplayString public struct URLS { - public static readonly string MAL_Series_Prefix = @"http://myanimelist.net/anime/"; - public static readonly string MAL_Series = @"http://myanimelist.net/anime/{0}"; - public static readonly string MAL_SeriesDiscussion = @"http://myanimelist.net/anime/{0}/{1}/forum"; + public static readonly string MAL_Series_Prefix = @"https://myanimelist.net/anime/"; + public static readonly string MAL_Series = @"https://myanimelist.net/anime/{0}"; + public static readonly string MAL_SeriesDiscussion = @"https://myanimelist.net/anime/{0}/{1}/forum"; public static readonly string AniDB_File = @"http://anidb.net/perl-bin/animedb.pl?show=file&fid={0}"; public static readonly string AniDB_Episode = @"http://anidb.net/perl-bin/animedb.pl?show=ep&eid={0}"; diff --git a/JMMServer/Providers/MyAnimeList/MALHelper.cs b/JMMServer/Providers/MyAnimeList/MALHelper.cs index d0bd83d4d..02377e1ff 100644 --- a/JMMServer/Providers/MyAnimeList/MALHelper.cs +++ b/JMMServer/Providers/MyAnimeList/MALHelper.cs @@ -36,7 +36,7 @@ public static anime SearchAnimesByTitle(string searchTitle) try { searchResultXML = - SendMALAuthenticatedRequest("http://myanimelist.net/api/anime/search.xml?q=" + searchTitle); + SendMALAuthenticatedRequest("https://myanimelist.net/api/anime/search.xml?q=" + searchTitle); } catch (Exception ex) { @@ -155,7 +155,7 @@ public static bool VerifyCredentials() string username = ServerSettings.MAL_Username; string password = ServerSettings.MAL_Password; - string url = "http://myanimelist.net/api/account/verify_credentials.xml"; + string url = "https://myanimelist.net/api/account/verify_credentials.xml"; HttpWebRequest webReq = (HttpWebRequest) WebRequest.Create(url); webReq.Timeout = 30*1000; webReq.Credentials = new NetworkCredential(username, password); @@ -348,7 +348,7 @@ public static myanimelist GetMALAnimeList() return null; } - string url = string.Format("http://myanimelist.net/malappinfo.php?u={0}&status=all&type=anime", + string url = string.Format("https://myanimelist.net/malappinfo.php?u={0}&status=all&type=anime", ServerSettings.MAL_Username); string malAnimeListXML = SendMALAuthenticatedRequest(url); malAnimeListXML = ReplaceEntityNamesByCharacter(malAnimeListXML); @@ -576,13 +576,12 @@ public static bool AddAnime(int animeId, int lastEpisodeWatched, int status, int { string res = ""; - string animeValuesXMLString = - string.Format( + string animeValuesXMLString = string.Format( "?data={0}{1}{2}", lastEpisodeWatched, status, score); res = - SendMALAuthenticatedRequest("http://myanimelist.net/api/animelist/add/" + animeId + ".xml" + + SendMALAuthenticatedRequest("https://myanimelist.net/api/animelist/add/" + animeId + ".xml" + animeValuesXMLString); if (res.Contains("201 Created") == false) { @@ -605,13 +604,12 @@ public static bool ModifyAnime(int animeId, int lastEpisodeWatched, int status, try { string res = ""; - string animeValuesXMLString = - string.Format( - "?data={0}{1}{2}", - lastEpisodeWatched, status, score); + string animeValuesXMLString = string.Format( + "?data={0}{1}{2}", + lastEpisodeWatched, status, score); res = - SendMALAuthenticatedRequest("http://myanimelist.net/api/animelist/update/" + animeId + ".xml" + + SendMALAuthenticatedRequest("https://myanimelist.net/api/animelist/update/" + animeId + ".xml" + animeValuesXMLString); if (res.Equals("Updated", StringComparison.InvariantCultureIgnoreCase) == false) {