Skip to content

Commit

Permalink
Merge pull request #386 from hidden4003/mal-api-updates
Browse files Browse the repository at this point in the history
Update MAL API to https
  • Loading branch information
hidden4003 authored Sep 3, 2016
2 parents 79b99f0 + c835ec6 commit f569bd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions JMMServer/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
Expand Down
20 changes: 9 additions & 11 deletions JMMServer/Providers/MyAnimeList/MALHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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=<entry><episode>{0}</episode><status>{1}</status><score>{2}</score></entry>",
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("<title>201 Created</title>") == false)
{
Expand All @@ -605,13 +604,12 @@ public static bool ModifyAnime(int animeId, int lastEpisodeWatched, int status,
try
{
string res = "";
string animeValuesXMLString =
string.Format(
"?data=<entry><episode>{0}</episode><status>{1}</status><score>{2}</score></entry>",
lastEpisodeWatched, status, score);
string animeValuesXMLString = string.Format(
"?data=<entry><episode>{0}</episode><status>{1}</status><score>{2}</score></entry>",
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)
{
Expand Down

0 comments on commit f569bd6

Please sign in to comment.