예제 #1
0
 public async override Task<ResultMessage> GetArtistInfo(string url)
 {
     try
     {
         string ss = await GetWebCode("view-source:" + url);
         Match ma = _cidRegex.Match(ss);
         if (ma.Success)
         {
             string _cid = ma.Groups[1].Value;
             ss = ChangeUnicode(await GetAPI(string.Format(_artistUrl, _cid)));
             var jpa = JsonConvert.DeserializeObject<JsonData_Patreon_Artist>(ss);
             if (null != jpa.data)
             {
                 var ai = new ArtistInfo()
                 {
                     Id = _cid,
                     Cid = _cid,
                     AName = GlobalMethord.RemoveLastDot(GlobalMethord.ReplacePath(jpa.data.attributes.name)),
                     PostUrl = url,
                     PayLow = GlobalData.VM_MA.Artist.PayLow,
                     PayHigh = GlobalData.VM_MA.Artist.PayHigh
                 };
                 return ResultHelper.NoError(ai);
             }
             return ResultHelper.IOError();
         }
         return ResultHelper.PathError();
     }
     catch (Exception ex)
     {
         GlobalMethord.ErrorLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "-----------------------------------------------");
         return ResultHelper.UnKnownError();
     }
 }
예제 #2
0
        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();
                }
            }));
        }
예제 #3
0
        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();
                }
            }));
        }