/// <summary> /// read json file to list /// </summary> /// <param name="url"></param> /// <returns></returns> public List <BarNameEntity> getJsonContent(string filepath) { List <BarNameEntity> listkeyWorldEntity = new List <BarNameEntity>(); try { if (string.IsNullOrEmpty(filepath)) { return(null); } IOFileHelper iOFileHelper = new IOFileHelper(); var strContext = iOFileHelper.ReadTxtFile(filepath); var byteData = strContext.Split('-'); UrlCodeConvert urlCodeConvert = new UrlCodeConvert(); foreach (var item in byteData) { BarNameEntity barNameEntity = new BarNameEntity(); barNameEntity.BarName = item.Trim(); barNameEntity.Url = urlCodeConvert.EncodeUrl(item.Trim()); listkeyWorldEntity.Add(barNameEntity); } return(listkeyWorldEntity); } catch { Debug.WriteLine("KeyWorldService"); } return(listkeyWorldEntity); }
public string UrlFiler(string tBName, string page = "1") { // https://tieba.baidu.com/f?kw=%E5%BF%B5%E7%A0%B4&ie=utf-8 //tbUrlHead=https://tieba.baidu.com/f?kw= UrlCodeConvert urlCodeConvert = new UrlCodeConvert(); string tbUrlHead = ConfigurationManager.AppSettings["TBUrlhead"]; return(tbUrlHead + urlCodeConvert.EncodeUrl(tBName) + "&ie=uft-8&pn=" + page); }