public static List <Listdata> Week(string weekCode, string type) { List <Listdata> list = new List <Listdata>(); int week = 0; try { week = Convert.ToInt32(weekCode); } catch { return(list); } try { string result = Network.GET(@"http://www.anissia.net/anitime/list?w=" + weekCode); JsonTextParser parser = new JsonTextParser(); JsonArrayCollection obj = (JsonArrayCollection)parser.Parse(result); foreach (JsonObjectCollection item in obj) { Listdata listitem = new Listdata() { Title = item["s"].GetValue().ToString(), Url = string.Format("{0}{1}", "http://www.anissia.net/anitime/cap?i=", item["i"].GetValue()), Type = type, Time = item["t"].GetValue().ToString(), Tag = item["i"].GetValue().ToString(), }; list.Add(listitem); } } catch (Exception ex) { list.Clear(); } return(list); }
public static List <Listdata> GetMakerList(string url, bool noti) { List <Listdata> listMaker = new List <Listdata>(); try { string result = Network.GET(url); JsonTextParser parser = new JsonTextParser(); JsonArrayCollection objCollection = (JsonArrayCollection)parser.Parse(result); foreach (JsonObjectCollection item in objCollection) { Listdata data = GetListData(item, noti); if (noti) { data.Url = url; } listMaker.Add(data); } listMaker.Sort(); } catch (Exception ex) { listMaker.Clear(); } return(listMaker); }
private void BwNoti_DoWork(object sender, DoWorkEventArgs e) { int weekday = (int)e.Argument; List <Listdata> listNoti = new List <Listdata>(); for (int i = -1; i <= 0; i++) { int day = (weekday + i + 7) % 7; foreach (Listdata data in Parser.Week(day.ToString(), "Noti")) { List <Listdata> list = Parser.GetMakerList(data.Url, true); if (list.Count > 0) { Listdata d = list[0]; d.Type = data.Title; listNoti.Add(d); } Thread.Sleep(100); } } listNoti.Sort(); e.Result = listNoti; }
public NotiItem(Listdata data) { InitializeComponent(); this.Data = data; this.textTitle.Text = data.Type; this.textEpisode.Text = data.Tag; this.textMaker.Text = data.Title; //this.textTime.Text = data.Time; this.Time = data.Time; }
public static List <Listdata> GetTorrentListNyaa(string keyword) { List <Listdata> list = new List <Listdata>(); string url1 = "https://www.nyaa.si/?page=rss&cats=1_0&term="; string url2 = "https://www.nyaa.si/?page=rss&cats=1_4&term="; try { int count = 0; string result = ""; if (Setting.ShowRaws) { result = Network.GET(string.Format("{0}{1}", url2, keyword)); } else { result = Network.GET(string.Format("{0}{1}", url1, keyword)); } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(result); XmlNodeList xmlnode = xmlDoc.SelectNodes("rss/channel/item"); foreach (XmlNode node in xmlnode) { Listdata data = new Listdata() { Title = node["title"].InnerText, Url = node["link"].InnerText, Raw = node["nyaa:categoryId"].InnerText == "1_4", Type = "Torrent", }; list.Add(data); if (++count >= 30) { break; } } } catch (Exception ex) { // MessageBox.Show(ex.Message); list.Clear(); } return(list); }
public static List <Listdata> GetTorrentListOhys(string keyword) { List <Listdata> list = new List <Listdata>(); string urlOhys = "https://torrents.ohys.net/download/rss.php?dir=new&q="; string[] urls = new string[] { urlOhys }; foreach (string url in urls) { try { int count = 0; string result = result = Network.GET(string.Format("{0}{1}", url, keyword)); if (string.IsNullOrEmpty(result)) { continue; } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(result); XmlNodeList xmlnode = xmlDoc.SelectNodes("rss/channel/item"); foreach (XmlNode node in xmlnode) { Listdata data = new Listdata() { Title = node["title"].InnerText, Url = node["link"].InnerText, Raw = true, Type = "Torrent", }; list.Add(data); if (++count >= 30) { break; } } } catch (Exception ex) { } } return(list); }
public static List <Listdata> getNaverCategoryPostList(string url) { List <Listdata> list = new List <Listdata>(); try { string html = Network.GET(url, "UTF-8"); // Blog id Uri uri = new UriBuilder(url).Uri; NameValueCollection query = HttpUtility.ParseQueryString(uri.Query); string blogId = query.Get("blogId"); string logNo = query.Get("logNo"); string categoryNo = query.Get("categoryNo"); string parentCategoryNo = query.Get("parentCategoryNo"); // etc HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); if (logNo == null) { string copyLinkIdPrefix = string.Format("url_{0}_", blogId); HtmlNode copyLinkNode = doc.DocumentNode.SelectSingleNode(string.Format("//p[contains(@id, '{0}')]", copyLinkIdPrefix)); if (copyLinkNode != null) { logNo = copyLinkNode.Id.Replace(copyLinkIdPrefix, "").Trim(); } else { return(list); } } if (categoryNo == null) { categoryNo = getJsValue(html, "categoryNo"); } if (parentCategoryNo == null) { parentCategoryNo = getJsValue(html, "parentCategoryNo"); } Dictionary <string, string> dict = new Dictionary <string, string>() { { "blogId", blogId }, { "logNo", logNo }, { "viewDate", "" }, { "categoryNo", categoryNo == "0" ? "" : categoryNo }, { "parentCategoryNo", parentCategoryNo }, { "showNextPage", "true" }, { "showPreviousPage", "false" }, { "sortDateInMilli", "" } }; string data = Function.GetHttpParams(dict); JsonTextParser parser = new JsonTextParser(); for (int i = 0; i < 3; i++) { string result = Network.POST("http://blog.naver.com/PostViewBottomTitleListAsync.nhn", data); if (result == "") { break; } JsonObjectCollection collect = (JsonObjectCollection)parser.Parse(result); JsonArrayCollection array = (JsonArrayCollection)collect["postList"]; foreach (JsonObjectCollection obj in array) { Listdata item = new Listdata( HttpUtility.HtmlDecode(HttpUtility.UrlDecode(obj["filteredEncodedTitle"].GetValue().ToString())), "Maker2", string.Format("http://blog.naver.com/{0}/{1}", blogId, obj["logNo"].GetValue())); list.Add(item); } bool hasNextPage = Convert.ToBoolean(collect["hasNextPage"].GetValue()); if (hasNextPage) { bool hasPreviousPage = Convert.ToBoolean(collect["hasPreviousPage"].GetValue()); string nextIndexLogNo = collect["nextIndexLogNo"].GetValue().ToString(); string nextIndexSortDate = collect["nextIndexSortDate"].GetValue().ToString(); dict["logNo"] = nextIndexLogNo; dict["sortDateInMilli"] = nextIndexSortDate; dict["showNextPage"] = hasNextPage.ToString().ToLower(); data = Function.GetHttpParams(dict); } else { break; } } } catch (Exception ex) { } return(list); }
private static Listdata GetListData(JsonObjectCollection item, bool noti) { Listdata data = new Listdata(); string episode = item["s"].GetValue().ToString(); bool isnum = false; if (episode.Length == 5) { isnum = true; int epinum = Convert.ToInt32(episode); if (epinum % 10 != 0) { episode = string.Format("{0:D2}.{1}", epinum / 10, epinum % 10); } else { episode = string.Format("{0:D2}", epinum / 10); } } data.Tag = episode; data.Url = item["a"].GetValue().ToString(); data.Type = "Maker"; if (noti) { data.Time = item["d"].GetValue().ToString(); data.Title = item["n"].GetValue().ToString(); } else { data.Title = string.Format("{0}{1} {2}", episode, isnum ? "화" : "", item["n"].GetValue()); data.Time = string.Format("{0}{1}", item["s"].GetValue().ToString(), item["d"].GetValue().ToString()); } try { Uri uri = new UriBuilder(data.Url).Uri; string host = uri.Host; if (host.IndexOf("naver.com") >= 0 || host.IndexOf("blog.me") >= 0) { data.SiteType = 1; } else if (host.IndexOf("tistory") >= 0) { data.SiteType = 2; } else if (host.IndexOf("egloos") >= 0) { data.SiteType = 3; } else if (host.IndexOf("fc2") >= 0) { data.SiteType = 4; } else { data.SiteType = 0; } } catch { } return(data); }
public ListItem(Listdata data) : this(false) { this.gridEpisodeBox.Visibility = Visibility.Collapsed; this.Title = data.Title; this.textTitle.FontSize = 14; this.Type = data.Type; ObjectType = ItemType.Listitem; if (this.Type == "Torrent" || this.Type == "Zip") { this.ToolTip = this.title; } switch (data.Type) { case "Anitable": this.Time = data.Time; this.Reference = data.Time; Grid.SetColumnSpan(this.textTitle, 2); break; default: this.Reference = data.Url; this.textTime.Visibility = Visibility.Collapsed; this.textTitle.Margin = new Thickness(15, 0, 0, 0); this.rect.Margin = new Thickness(15, 0, 0, 0); Grid.SetColumn(this.rect, 0); Grid.SetColumn(this.textTitle, 0); Grid.SetColumnSpan(this.textTitle, 3); if (data.Raw) { SetTitleColor(this.title); if (!Setting.ShowRaws) { this.textTitle.FontWeight = FontWeights.SemiBold; } } else if (this.Type == "Torrent") { this.textTitle.Foreground = Brushes.Gray; this.textTitle.FontWeight = FontWeights.Normal; } break; } string sitetype = "DefaultTag"; switch (data.SiteType) { case 0: break; case 1: sitetype = "NaverTag"; break; case 2: sitetype = "TistoryTag"; break; case 3: sitetype = "EgloosTag"; break; case 4: sitetype = "Fc2Tag"; break; default: return; } try { sitetag.Fill = FindResource(sitetype) as SolidColorBrush; sitetag.Visibility = Visibility.Visible; } catch { } }