public async override Task <ResultMessage> GetArtistList() { return(await Task.Run(() => { try { var ais = new List <ArtistInfo>(); var tais = GlobalData.VM_MA.ArtistList.ToList(); if (tais.Count == 0) { tais.Add(new ArtistInfo()); } var jfp = JsonConvert.DeserializeObject <JsonData_Fanbox_Plan>(GetWebCode("https://api.fanbox.cc/plan.listSupporting", "https://www.fanbox.cc/creators/supporting")); if (null != jfp.body) { foreach (var pl in jfp.body) { var ai = GetInfo(pl.creatorId, $"https://www.fanbox.cc/@{pl.creatorId}"); if (null != ai) { ai.PayHigh = pl.fee.ToString(); tais.Remove(ai); ais.Add(ai); } } ais.AddRange(tais); return ResultHelper.NoError(ais); } return ResultHelper.IOError(); } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); if (ex is WebException || ex is System.Net.Sockets.SocketException) { return ex.Message.Contains("40") ? ResultHelper.CookieError() : ResultHelper.WebError(); } return ResultHelper.UnKnownError(); } })); }
public async override Task <ResultMessage> GetPostIDs(string uid) { return(await Task.Run(() => { var bis = new List <BaseItem>(); try { string url = $"https://api.fanbox.cc/post.listCreator?creatorId={uid}&limit=10"; if (string.IsNullOrEmpty(_referer)) { _referer = $"https://{uid}.fanbox.cc"; } string nurl = GetUrls(GetWebCode(url), bis); if (!string.IsNullOrEmpty(nurl)) { GetPostIDs_Next(nurl, bis); } return ResultHelper.NoError(bis); } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); if (ex is WebException || ex is System.Net.Sockets.SocketException) { return ex.Message.Contains("401") ? ResultHelper.CookieError() : ResultHelper.WebError(); } return ResultHelper.UnKnownError(); } })); }
public async override Task <ResultMessage> GetArtistInfo(string url) { return(await Task.Run(() => { try { Match ma = _artUrl.Match(url); if (!ma.Success) { ma = _artUrl2.Match(url); if (!ma.Success) { return ResultHelper.PathError(); } } _referer = $"https://www.fanbox.cc/@{ma.Groups[1].Value}"; var ai = GetInfo(ma.Groups[1].Value); if (null != ai) { ai.PayLow = GlobalData.VM_MA.Artist.PayLow; ai.PayHigh = GlobalData.VM_MA.Artist.PayHigh; return ResultHelper.NoError(ai); } return ResultHelper.IOError(); } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); if (ex is WebException || ex is System.Net.Sockets.SocketException) { return ex.Message.Contains("40") ? ResultHelper.CookieError() : ResultHelper.WebError(); } return ResultHelper.UnKnownError(); } })); }
public async override Task <ResultMessage> LikePost(string pid, string cid) { return(await Task.Run(() => ResultHelper.UnKnownError(GlobalLanguage.Msg_ErrorUnSupported))); }
public async override Task <ResultMessage> GetArtistList() { return(await Task.Run(() => { try { List <ArtistInfo> ais = new List <ArtistInfo>(); //有料 ais.AddRange(GetArtistListFromWebCode("not_")); //無料 ais.AddRange(GetArtistListFromWebCode(string.Empty)); var tais = GlobalData.VM_MA.ArtistList.ToList(); if (tais.Count == 0) { tais.Add(new ArtistInfo()); } tais.ForEach(x => { if (!ais.Contains(x)) { ais.Add(x); } }); return ResultHelper.NoError(ais); } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); if (ex is WebException || ex is System.Net.Sockets.SocketException) { return ex.Message.Contains("40") ? ResultHelper.CookieError() : ResultHelper.WebError(); } return ResultHelper.UnKnownError(); } })); }
public async override Task <ResultMessage> GetArtistInfo(string url) { return(await Task.Run(() => { try { Match ma = _artUrl.Match(url); if (!ma.Success) { return ResultHelper.PathError(); } string cid = ma.Groups[1].Value; var jfa = JsonConvert.DeserializeObject <JsonData_Fantia_Artist>(GetWebCode($"https://fantia.jp/api/v1/fanclubs/{cid}")); if (null != jfa.fanclub) { var ai = new ArtistInfo() { Id = cid, AName = GlobalMethord.RemoveLastDot(GlobalMethord.ReplacePath(jfa.fanclub.creator_name)), Cid = cid, PostUrl = $"https://fantia.jp/fanclubs/{cid}", PayLow = GlobalData.VM_MA.Artist.PayLow, PayHigh = GlobalData.VM_MA.Artist.PayHigh }; return ResultHelper.NoError(ai); } return ResultHelper.IOError(); } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); if (ex is WebException || ex is System.Net.Sockets.SocketException) { return ex.Message.Contains("40") ? ResultHelper.CookieError() : ResultHelper.WebError(); } return ResultHelper.UnKnownError(); } })); }
public async override Task <ResultMessage> GetPostIDs(string uid) { return(await Task.Run(() => { try { _pidList = new HashSet <string>(); var bis = GetPostIDsFromWebCode(uid); return ResultHelper.NoError(bis); } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); if (ex is WebException || ex is System.Net.Sockets.SocketException) { return ex.Message.Contains("40") ? ResultHelper.CookieError() : ResultHelper.WebError(); } else if (ex is InvalidDataException) { return ResultHelper.UnKnownError("Post Error: " + ex.Message); } return ResultHelper.UnKnownError(); } })); }
public async override Task<ResultMessage> GetPostIDs(string uid) { try { string ss = ChangeUnicode(await GetAPI(string.Format(_postUrl, uid))); List<BaseItem> pis = new List<BaseItem>(); while (true) { var jpp = JsonConvert.DeserializeObject<JsonData_Patreon_Post>(ss); if (null != jpp.data && null != jpp.included && null != jpp.meta) { var incll = jpp.included.ToList(); for (int i = 0; i < jpp.data.Length; i++) { if (DateTime.TryParse(jpp.data[i].attributes.published_at, out DateTime dt)) { if (GlobalMethord.OverTime(dt)) { return ResultHelper.NoError(pis); } } PatreonItem pi = new PatreonItem() { CreateDate = dt, UpdateDate = dt, PID = jpp.data[i].id, Title = GlobalMethord.RemoveLastDot(GlobalMethord.ReplacePath(jpp.data[i].attributes.title)), IsLiked = jpp.data[i].attributes.current_user_has_liked, PLink = jpp.data[i].attributes.url }; GlobalData.VM_MA.PostTitle = pi.Title; if (!string.IsNullOrEmpty(jpp.data[i].attributes.content)) { pi.Comments.Add(await GetWebContent(_htmlImg.Replace(jpp.data[i].attributes.content, ""))); } else if (!string.IsNullOrEmpty(jpp.data[i].attributes.content_teaser_text)) { pi.Comments.Add(jpp.data[i].attributes.content_teaser_text); } if (jpp.data[i].attributes.current_user_can_view) { if (null != jpp.data[i].attributes.image) { pi.CoverPicThumb = jpp.data[i].attributes.image.thumb_url; } if (null != jpp.data[i].attributes.embed) { pi.Comments.Add($"<{GlobalLanguage.Text_LinkPref} {jpp.data[i].attributes.embed.url} >"); } if (null != jpp.data[i].relationships.media) { for (int j = 0; j < jpp.data[i].relationships.media.data.Length; j++) { var inclu = incll.Find(x => x.id == jpp.data[i].relationships.media.data[j].id); if (string.IsNullOrEmpty(inclu.attributes.file_name)) { inclu.attributes.file_name = "default."; if (!string.IsNullOrEmpty(inclu.attributes.mimetype)) { var tep = inclu.attributes.mimetype.Split('/'); if (tep.Length == 2) { inclu.attributes.file_name += tep[1]; } else { inclu.attributes.file_name += inclu.attributes.mimetype; } } else inclu.attributes.file_name += "png"; } else if (inclu.attributes.file_name.StartsWith("https://")) { continue; } pi.ContentUrls.Add(inclu.attributes.image_urls.original); pi.FileNames.Add(inclu.attributes.file_name); pi.Comments.Add($"<{GlobalLanguage.Text_FilePref} {inclu.attributes.file_name}>"); } } } pis.Add(pi); GlobalData.VM_MA.PostCount++; } if (null != jpp.meta.pagination.cursors) { ss = ChangeUnicode(await GetAPI(string.Format(_nextUrl, uid, jpp.meta.pagination.cursors.next))); continue; } return ResultHelper.NoError(pis); } return ResultHelper.IOError(); } } catch (Exception ex) { GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------"); return ResultHelper.UnKnownError(); } }