private async Task <ObservableCollection <MusicHomeMenuModel> > RefreshMenu(string data, int time, int pageSize)
        {
            try
            {
                pr_load.Visibility = Visibility.Visible;
                string url = string.Format("https://api.bilibili.com/audio/music-service-c/firstpage/{2}?appkey={0}&build=5250000&mobi_app=android&platform=android&size={3}&time={4}&ts={1}", ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan, data, pageSize, time);
                url += "&sign=" + ApiHelper.GetSign(url);

                var re = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                MusicRefreshMenuModel m = Newtonsoft.Json.JsonConvert.DeserializeObject <MusicRefreshMenuModel>(re);
                if (m.code == 0)
                {
                    return(m.data);
                }
                else
                {
                    Utils.ShowMessageToast(m.message);
                    return(null);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("加载音频首页失败");
                return(null);
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
            }
        }
Example #2
0
        private async void LoadHome()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                string url = string.Format("https://bangumi.bilibili.com/appindex/follow_index_page?appkey={0}&build=5250000&mobi_app=android&platform=wp&ts={1}000", ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                BangumiHomeModel m = JsonConvert.DeserializeObject <BangumiHomeModel>(results);
                if (m.code == 0)
                {
                    this.DataContext = m;
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取推荐信息", 3000);
                }
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
        private async void LoadMusicHome()
        {
            try
            {
                sharkMenus         = 1;
                pgcMenus           = 1;
                missevan           = 1;
                HitSongs           = 1;
                pr_load.Visibility = Visibility.Visible;
                string url = string.Format("https://api.bilibili.com/audio/music-service-c/firstpage?appkey={0}&build=5250000&mobi_app=android&platform=android&ts={1}", ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);

                var re = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                MusicHomeModel m = Newtonsoft.Json.JsonConvert.DeserializeObject <MusicHomeModel>(re);
                if (m.code == 0)
                {
                    this.DataContext = m.data;
                }
                else
                {
                    Utils.ShowMessageToast(m.message);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("加载音频首页失败");
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
            }
        }
Example #4
0
        private async void GetList(string name)
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                wc = new WebClientClass();
                string url = string.Format("http://www.dilidili.com{0}", name);
                string results = await wc.GetResultsUTF8Encode(new Uri(url));
                MatchCollection mc = Regex.Matches(results, @"<li><a href=""(.*?)"" target=""_self""><em><span>(.*?)</span>(.*?)</em></a></li>", RegexOptions.Multiline);
                List<DModel> listModel = new List<DModel>();
                foreach (Match item in mc)
                {
                    listModel.Add(new DModel()
                    {
                        url = item.Groups[1].Value,
                       num=item.Groups[2].Value,
                       desc=item.Groups[3].Value
                    });
                }
                list_Video.ItemsSource = listModel;
            }
            catch (Exception)
            {
                messShow.Show("读取失败", 3000);
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }

        }
Example #5
0
        private async void GetList(string name)
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                wc = new WebClientClass();
                string url     = string.Format("http://www.dilidili.com{0}", name);
                string results = await wc.GetResultsUTF8Encode(new Uri(url));

                MatchCollection mc        = Regex.Matches(results, @"<li><a href=""(.*?)"" target=""_self""><em><span>(.*?)</span>(.*?)</em></a></li>", RegexOptions.Multiline);
                List <DModel>   listModel = new List <DModel>();
                foreach (Match item in mc)
                {
                    listModel.Add(new DModel()
                    {
                        url  = item.Groups[1].Value,
                        num  = item.Groups[2].Value,
                        desc = item.Groups[3].Value
                    });
                }
                list_Video.ItemsSource = listModel;
            }
            catch (Exception)
            {
                messShow.Show("读取失败", 3000);
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #6
0
        private async void LoadMy()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                string url = string.Format("http://bangumi.bilibili.com/api/get_concerned_season?build=520001&platform=android&appkey={0}&access_key={1}&page={2}&pagesize=9&ts={3}", ApiHelper.AndroidKey.Appkey, ApiHelper.access_key, 1, ApiHelper.GetTimeSpan_2);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                MyBangumiModel m = JsonConvert.DeserializeObject <MyBangumiModel>(results);
                if (m.code == 0)
                {
                    list_ban_mine.ItemsSource = m.result;
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取追番失败了", 3000);
                }
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
        private async void GetNotify()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;

                //http://message.bilibili.com/api/notify/query.sysnotify.list.do?_device=android&_hwid=68fc5d795c256cd1&_ulv=10000&access_key=a36a84cc8ef4ea2f92c416951c859a25&actionKey=appkey&appkey=c1b107428d337928&build=414000&data_type=1&page_size=40&platform=android&ts=1461404973000&sign=fc3b4e26348a1204e2064e7712d10179
                string url = string.Format("https://message.bilibili.com/api/notify/query.sysnotify.list.do?_device=android&&_ulv=10000&access_key={0}&actionKey=appkey&appkey={1}&build=518000&data_type=1&page_size=40&platform=android&ts={2}", ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                MessageReplyModel model = JsonConvert.DeserializeObject <MessageReplyModel>(results);
                if (model.code == 0)
                {
                    List <MessageReplyModel> list = JsonConvert.DeserializeObject <List <MessageReplyModel> >(model.data.ToString());
                    list_Notify.ItemsSource = list;
                }
                else
                {
                    Utils.ShowMessageToast("读取失败" + model.message, 3000);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("读取失败", 3000);
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #8
0
        private async void LoadTag()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                string url = string.Format("https://bangumi.bilibili.com/api/bangumi_index_cond?access_key={0}&appkey={1}&build=5250000&mobi_app=android&platform=wp&ts={2}000&type=0", ApiHelper.access_key, ApiHelper._appKey, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                BantagModel m = JsonConvert.DeserializeObject <BantagModel>(results);
                if (m.code == 0)
                {
                    List <FilterModel> Years = new List <FilterModel>();
                    m.result.years.OrderByDescending(x => x).ToList().ForEach(x => Years.Add(new FilterModel()
                    {
                        name = x, data = x
                    }));
                    Years.Insert(0, new FilterModel()
                    {
                        name = "全部", data = "-1"
                    });
                    view_Year.ItemsSource   = Years;
                    view_Year.SelectedIndex = 0;

                    List <FilterModel> Tags = new List <FilterModel>();
                    m.result.category.ForEach(x => Tags.Add(new FilterModel()
                    {
                        name = x.tag_name, data = x.tag_id
                    }));
                    Tags.Insert(0, new FilterModel()
                    {
                        name = "全部", data = "-1"
                    });
                    view_FG.ItemsSource   = Tags;
                    view_FG.SelectedIndex = 0;

                    GetInfo();
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取风格索引失败了", 3000);
                }
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #9
0
        private async void GetDynamicVideos()
        {
            try
            {
                _Loading           = true;
                pr_Load.Visibility = Visibility.Visible;
                string url = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?access_key={ApiHelper.access_key}&appkey={ApiHelper.AndroidKey.Appkey}&build={ApiHelper.build}&mobi_app=android&platform=android&qn=32&rsp_type=2&src=bili&ts={ApiHelper.GetTimeSpan_2}&type_list=8%2C512%2C4099&uid={ApiHelper.GetUserId()}&update_num_dy_id=0";
                if (ls_video.Count() != 0)
                {
                    url = $"https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_history?access_key={ApiHelper.access_key}&appkey={ApiHelper.AndroidKey.Appkey}&build={ApiHelper.build}&mobi_app=android&offset_dynamic_id={ls_video.GetLastDynamicId()}&page={_page}&platform=android&qn=32&rsp_type=2&src=bili&ts={ApiHelper.GetTimeSpan_2}&type_list=8%2C512%2C4099&uid={ApiHelper.GetUserId()}";
                }
                else
                {
                    _page = 0;
                }
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                results = results.Replace("default", "_default");
                DynamicModel dynamicModel = JsonConvert.DeserializeObject <DynamicModel>(results);
                if (dynamicModel.code == 0)
                {
                    ObservableCollection <DynamicCardsModel> cards = new ObservableCollection <DynamicCardsModel>();
                    foreach (var item in dynamicModel.data.cards)
                    {
                        if (item.desc.type != 32)
                        {
                            cards.Add(item);
                        }
                    }

                    ls_video.LoadData(cards);
                    _page++;
                }
                else
                {
                    Utils.ShowMessageToast(dynamicModel.msg);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("动态加载错误", 3000);
                }
            }
            finally
            {
                _Loading = false;

                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #10
0
        private async void Search()
        {
            try
            {
                search.Visibility  = Visibility.Collapsed;
                _loadRoom          = true;
                _loadUser          = true;
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Format("https://search.bilibili.com/api/search?search_type=live&keyword={0}&page=1",
                                           Uri.EscapeDataString(_keyword));
                // url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                JObject         jObject = JObject.Parse(results);
                LiveSearchModel m       = JsonConvert.DeserializeObject <LiveSearchModel>(results);
                if (m.code == 0)
                {
                    if (Convert.ToInt32(jObject["pageinfo"]["live_user"]["total"].ToString()) != 0)
                    {
                        txt_hea_1.Text = "主播(" + jObject["pageinfo"]["live_user"]["total"].ToString() + ")";
                        JsonConvert.DeserializeObject <List <LiveSearchModel> >(jObject["result"]["live_user"].ToString()).ForEach(x => list_Feed.Items.Add(x));
                        //_page_user++;
                    }
                    if (Convert.ToInt32(jObject["pageinfo"]["live_room"]["total"].ToString()) != 0)
                    {
                        txt_hea_0.Text = "正在直播(" + jObject["pageinfo"]["live_room"]["total"].ToString() + ")";
                        JsonConvert.DeserializeObject <List <LiveSearchModel> >(jObject["result"]["live_room"].ToString()).ForEach(x => gv_Room.Items.Add(x));
                        _page_room++;
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("发生错误\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                _loadRoom          = false;
                _loadUser          = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #11
0
        private async void GetDynamic()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                _loadDynamic       = true;

                string url = string.Format("https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_new?topic_name={0}&_device=android&access_key={1}&appkey={2}&build=5250000&mobi_app=android&platform=android&qn=32&src=bilih5&ts={3}",
                                           tag, ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan_2);

                if (ls_dynamic.Count() != 0)
                {
                    url = string.Format("https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history?topic_name={0}&offset_dynamic_id={4}&_device=android&access_key={1}&appkey={2}&build=5250000&mobi_app=android&platform=android&qn=32&src=bilih5&ts={3}",
                                        tag, ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan_2, ls_dynamic.GetLastDynamicId());
                }

                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                results = results.Replace("default", "_default");
                DynamicModel dynamicModel = JsonConvert.DeserializeObject <DynamicModel>(results);
                if (dynamicModel.code == 0)
                {
                    if (dynamicModel.data.cards == null)
                    {
                        Utils.ShowMessageToast("没有更多动态了");
                        return;
                    }
                    ObservableCollection <DynamicCardsModel> cards = new ObservableCollection <DynamicCardsModel>();
                    foreach (var item in dynamicModel.data.cards)
                    {
                        if (item.desc.type != 32)
                        {
                            cards.Add(item);
                        }
                    }
                    ls_dynamic.LoadData(cards);
                }
                else
                {
                    Utils.ShowMessageToast(dynamicModel.msg);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("读取综合动态失败");
            }
            finally
            {
                _loadDynamic       = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #12
0
        /// <summary>
        /// 加载at关注列表
        /// </summary>
        private async void LoadAtList()
        {
            try
            {
                pr_LoadUserAt.Visibility = Visibility.Visible;
                _loadingAt = true;
                string url = "http://api.live.bilibili.com/feed_svr/v1/feed_svr/get_user_info?access_key={0}&appkey={1}&build=5250000&page={2}&pagesize=20&platform=android&src=bilih5&ts={3}";
                url  = string.Format(url, ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, _userAtPage, ApiHelper.GetTimeSpan_2);
                url += "&sign=" + ApiHelper.GetSign(url);
                var results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                userAtListModel userAtListModel = JsonConvert.DeserializeObject <userAtListModel>(results);
                if (userAtListModel.code == 0)
                {
                    if (userAtListModel.data.info.Count == 0)
                    {
                        btn_LoadMoreUserAt.Visibility = Visibility.Collapsed;
                        Utils.ShowMessageToast("加载完了...");
                    }
                    else
                    {
                        if (_userAtPage == 1)
                        {
                            ls_UserAt.ItemsSource = userAtListModel.data.info;
                        }
                        else
                        {
                            foreach (var item in userAtListModel.data.info)
                            {
                                (ls_UserAt.ItemsSource as ObservableCollection <userAtListModel>).Add(item);
                            }
                        }
                        btn_LoadMoreUserAt.Visibility = Visibility.Visible;
                        _userAtPage++;
                    }
                }
                else
                {
                    Utils.ShowMessageToast(userAtListModel.message);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("加载关注列表失败");
            }
            finally
            {
                pr_LoadUserAt.Visibility = Visibility.Collapsed;
                _loadingAt = false;
            }
        }
Example #13
0
        private async void AddUser()
        {
            try
            {
                _loadUser          = true;
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Format("https://search.bilibili.com/api/search?search_type=live_user&keyword={0}&page={1}&order=online&coverType=user_cover&_t={2}", Uri.EscapeDataString(_keyword), _page_user, ApiHelper.GetTimeSpan_2);
                //url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                LiveSearchModel m       = JsonConvert.DeserializeObject <LiveSearchModel>(results);
                JObject         jObject = JObject.Parse(results);
                if (m.code == 0)
                {
                    List <LiveSearchModel> ls = JsonConvert.DeserializeObject <List <LiveSearchModel> >(jObject["result"].ToString());


                    if (ls.Count != 0)
                    {
                        ls.ForEach(x => list_Feed.Items.Add(x));
                        _page_user++;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("发生错误\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                _loadUser          = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #14
0
        private async void LoadTj()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                _loading           = true;
                if (cursor == "-1")
                {
                    list_ban_jp_foot.Items.Clear();
                }
                string url = string.Format("https://bangumi.bilibili.com/api/bangumi_recommend?access_key={0}&appkey={1}&build=5250000&cursor={2}&mobi_app=android&pagesize=10&platform=wp&ts={3}000&type=0", ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, cursor, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                BanTJModel m = JsonConvert.DeserializeObject <BanTJModel>(results);
                if (m.code == 0)
                {
                    if (m.result.Count != 0)
                    {
                        m.result.ForEach(x => list_ban_jp_foot.Items.Add(x));
                        //list_ban_jp_foot.ItemsSource = m.result;
                        cursor = m.result.Last().cursor;
                    }
                    else
                    {
                        Utils.ShowMessageToast("全部加载完...", 2000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取推荐信息", 3000);
                }
            }
            finally
            {
                _loading           = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #15
0
        private async void AddRoom()
        {
            try
            {
                _loadRoom          = true;
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Format("https://api.bilibili.com/x/web-interface/search/type?search_type=live&highlight=0&keyword={0}&page={1}", Uri.EscapeDataString(_keyword), _page_room);
                //url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                LiveSearchModel m       = JsonConvert.DeserializeObject <LiveSearchModel>(results);
                JObject         jObject = JObject.Parse(results);
                if (m.code == 0)
                {
                    List <LiveSearchModel> ls = JsonConvert.DeserializeObject <List <LiveSearchModel> >(jObject["data"]["result"]["live_room"].ToString());


                    if (ls.Count != 0)
                    {
                        ls.ForEach(x => gv_Room.Items.Add(x));
                        _page_room++;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    Utils.ShowMessageToast("检查你的网络连接!", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("发生错误\r\n" + ex.Message, 3000);
                }
            }
            finally
            {
                _loadRoom          = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #16
0
        private async void LoadMy()
        {
            try
            {
                if (_page == 1)
                {
                    list.Items.Clear();
                }
                _loading           = true;
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Format("https://bangumi.bilibili.com/follow/api/list/mine?access_key={0}&appkey={1}&build=5250000&mobi_app=android&page={2}&pagesize=20&platform=android&ts={3}", ApiHelper.access_key, ApiHelper._appKey, _page, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                MyMovieModel m = JsonConvert.DeserializeObject <MyMovieModel>(results);
                if (m.code == 0)
                {
                    if (m.result.Count == 0)
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                        return;
                    }
                    m.result.ForEach(x => list.Items.Add(x));
                    // list_ban_mine.ItemsSource = m.result;
                    _page++;
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取追番失败了", 3000);
                }
            }
            finally
            {
                _loading           = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #17
0
        private async void GetInfo()
        {
            try
            {
                _Loading           = true;
                pr_Load.Visibility = Visibility.Visible;
                if (PageNum == 1)
                {
                    gv1.Items.Clear();
                }

                string url     = "https://bangumi.bilibili.com/web_api/season/index_global?page=" + PageNum + "&page_size=30&version=" + (view_LX.SelectedItem as FilterModel).data + "&is_finish=" + (view_ZT.SelectedItem as FilterModel).data + "&start_year=" + (view_Year.SelectedItem as FilterModel).data + "&quarter=" + (view_Quarter.SelectedItem as FilterModel).data + "&tag_id=" + (view_FG.SelectedItem as FilterModel).data + "&index_type=" + index_type + "&index_sort=" + index_sort + ((view_DQ.SelectedIndex != 0)?"&area=" + (view_DQ.SelectedItem as FilterModel).data:"");
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                AllBanModel m = JsonConvert.DeserializeObject <AllBanModel>(results);
                if (m.code == 0)
                {
                    if (m.result.list.Count != 0)
                    {
                        m.result.list.ForEach(x => gv1.Items.Add(x));
                        PageNum++;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了...", 3000);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取番剧失败了", 3000);
                }
            }
            finally
            {
                _Loading           = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #18
0
        private async void GetDynamic()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                _loadDynamic       = true;
                var next = "";
                var u    = "dynamic_new";
                if (ls_dynamic.Count() != 0)
                {
                    u    = "dynamic_history";
                    next = "&offset_dynamic_id=" + ls_dynamic.GetLastDynamicId();
                }

                string url = string.Format("https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/{5}?access_key={0}&appkey={1}&build=5250000&mobi_app=android&platform=android&qn=32&rsp_type=2&src=bilih5&ts={2}&type=268435455&uid={3}{4}",
                                           ApiHelper.AccessKey, ApiHelper.AndroidKey.Appkey, ApiHelper.TimeStamp2, ApiHelper.GetUserId(), next, u);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                results = results.Replace("default", "_default");
                DynamicModel dynamicModel = JsonConvert.DeserializeObject <DynamicModel>(results);
                if (dynamicModel.code == 0)
                {
                    ObservableCollection <DynamicCardsModel> cards = new ObservableCollection <DynamicCardsModel>();
                    foreach (var item in dynamicModel.data.cards)
                    {
                        if (item.desc.type != 32)
                        {
                            cards.Add(item);
                        }
                    }

                    ls_dynamic.LoadData(cards);
                }
                else
                {
                    Utils.ShowMessageToast(dynamicModel.msg);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("读取综合动态失败");
            }
            finally
            {
                _loadDynamic       = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #19
0
        public static async Task <List <QualityModel> > GetVideoQualities(PlayerModel model)
        {
            List <QualityModel> qualities = new List <QualityModel>();

            try
            {
                var qn = 64;

                string url = string.Format("https://interface.bilibili.com/v2/playurl?cid={1}&appkey={0}&otype=json&type=&quality={2}&qn={2}&ts={3}", ApiHelper._appKey_VIDEO, model.Mid, qn, ApiHelper.GetTimeSpan_2);
                url += "&sign=" + ApiHelper.GetSign_VIDEO(url);
                string re = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                //var mc = Regex.Matches(re, @"<length>(.*?)</length>.*?<size>(.*?)</size>.*?<url><!\[CDATA\[(.*?)\]\]></url>", RegexOptions.Singleline);
                FlvPlyaerUrlModel m = JsonConvert.DeserializeObject <FlvPlyaerUrlModel>(re);

                foreach (var item in m.accept_description)
                {
                    qualities.Add(new QualityModel()
                    {
                        description = item,
                        qn          = m.accept_quality[m.accept_description.IndexOf(item)]
                    });
                }
                qualities = qualities.OrderBy(x => x.qn).ToList();
                return(qualities);
            }
            catch (Exception)
            {
                return(new List <QualityModel>()
                {
                    new QualityModel()
                    {
                        description = "流畅", qn = 32
                    },
                    new QualityModel()
                    {
                        description = "清晰", qn = 64
                    },
                    new QualityModel()
                    {
                        description = "高清", qn = 80
                    },
                    new QualityModel()
                    {
                        description = "超清", qn = 112
                    },
                });
            }
        }
Example #20
0
        private async void GetHot()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                _loadHot           = true;

                string url = string.Format("https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/recommend?_device=android&access_key={0}&appkey={1}&build=5250000&mobi_app=android&page={2}&platform=android&qn=32&src=bilih5&ts={3}&uid={4}",
                                           ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, _pageHot, ApiHelper.GetTimeSpan_2, ApiHelper.GetUserId());
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));


                results = results.Replace("default", "_default");
                DynamicModel dynamicModel = JsonConvert.DeserializeObject <DynamicModel>(results);
                if (dynamicModel.code == 0)
                {
                    ObservableCollection <DynamicCardsModel> cards = new ObservableCollection <DynamicCardsModel>();
                    foreach (var item in dynamicModel.data.cards)
                    {
                        if (item.desc.type != 32)
                        {
                            cards.Add(item);
                        }
                    }

                    ls_hot.LoadData(cards, _pageHot == 1);

                    _pageHot++;
                }
                else
                {
                    Utils.ShowMessageToast(dynamicModel.msg);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("读取热门动态失败");
            }
            finally
            {
                _loadHot           = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #21
0
        public async void GetDeveloperMessage()
        {
            try
            {
                var results = await WebClientClass.GetResultsUTF8Encode(new Uri("http://pic.iliili.cn/bilimessageV3.json?rnd=" + ApiHelper.GetTimeSpan_2));

                DeveloperMessageModel messageModel = JsonConvert.DeserializeObject <DeveloperMessageModel>(results);
                if (!messageModel.showAD)
                {
                    MessageCenter.SendHideAd();
                }
                if (Get_FirstShowMessage(messageModel.messageId) && messageModel.enddate > DateTime.Now)
                {
                    var        cd         = new ContentDialog();
                    StackPanel stackPanel = new StackPanel();
                    //TextBlock title = new TextBlock() {
                    //    Text= messageModel.title,
                    //    TextWrapping= Windows.UI.Xaml.TextWrapping.Wrap,
                    //    IsTextSelectionEnabled = true
                    //};
                    //stackPanel.Children.Add(title);
                    cd.Title = messageModel.title;
                    TextBlock content = new TextBlock()
                    {
                        Text                   = messageModel.message,
                        TextWrapping           = Windows.UI.Xaml.TextWrapping.Wrap,
                        IsTextSelectionEnabled = true
                    };
                    stackPanel.Children.Add(content);
                    cd.Content             = stackPanel;
                    cd.PrimaryButtonText   = "不再显示";
                    cd.SecondaryButtonText = "知道了";

                    cd.PrimaryButtonClick += new Windows.Foundation.TypedEventHandler <ContentDialog, ContentDialogButtonClickEventArgs>((sender, e) =>
                    {
                        Set_FirstShowMessage(messageModel.messageId, false);
                    });
                    await cd.ShowAsync();
                }
            }
            catch (Exception)
            {
            }
        }
Example #22
0
        private async void GetRankInfo()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Empty;
                if (cb_Cb.SelectedIndex == 0)
                {
                    url = string.Format("http://bangumi.bilibili.com/sponsor/rank/get_sponsor_week_list?access_key={0}&appkey={1}&build=418000&mobi_app=android&page=1&pagesize=25&platform=android&season_id={2}&ts={3}", ApiHelper.access_key, ApiHelper._appKey_Android, _banId, ApiHelper.GetTimeSpan);
                }
                else
                {
                    url = string.Format("http://bangumi.bilibili.com/sponsor/rank/get_sponsor_total?access_key={0}&appkey={1}&build=418000&mobi_app=android&page=1&pagesize=25&platform=android&season_id={2}&ts={3}", ApiHelper.access_key, ApiHelper._appKey_Android, _banId, ApiHelper.GetTimeSpan);
                }
                url += "&sign=" + ApiHelper.GetSign_Android(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                CBRankModel model = JsonConvert.DeserializeObject <CBRankModel>(results);
                if (model.code == 0)
                {
                    CBRankModel        resultModel = JsonConvert.DeserializeObject <CBRankModel>(model.result.ToString());
                    List <CBRankModel> ls          = JsonConvert.DeserializeObject <List <CBRankModel> >(resultModel.list.ToString());
                    list_Rank.ItemsSource = ls;
                }
                else
                {
                    Utils.ShowMessageToast("读取承包失败," + model.message, 3000);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("读取承包失败", 3000);
                //throw;
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #23
0
        private async void GetListInfo(string date)
        {
            try
            {
                pr_load.Visibility = Visibility.Visible;
                wc = new WebClientClass();
                string url     = string.Format("http://www.dilidili.com/anime/{0}/", date);
                string results = await wc.GetResultsUTF8Encode(new Uri(url));

                MatchCollection mc = Regex.Matches(results, @"<dl>.*?<dt><a hrel=""(.*?)""><img src=""(.*?)""/></a></dt>.*?<dd>.*?<h3><a href=""(.*?)"">(.*?)</a></h3>.*?<p><div class=""d_label""><b>地区:</b>(.*?)</div><div class=""d_label""><b>年代:</b>(.*?)</div></p>.*?<p><div class=""d_label""><b>标签:</b>(.*?)</div><div class=""d_label""><b>播放:</b>(.*?)</div></p>.*?<p><b>看点:</b>(.*?)</p>.*?<p><b>简介:</b>(.*?)</p>.*?<p><b style=""color:#F00"">状态:</b>(.*?)</p>.*?</dd>.*?</dl>", RegexOptions.Singleline);
                if (mc.Count == 0)
                {
                    mc = Regex.Matches(results, @"<dl>.*?<dt><a href=""(.*?)""><img src=""(.*?)""/></a></dt>.*?<dd>.*?<h3><a href=""(.*?)"">(.*?)</a></h3>.*?<p><div class=""d_label""><b>地区:</b>(.*?)</div><div class=""d_label""><b>年代:</b>(.*?)</div></p>.*?<p><div class=""d_label""><b>标签:</b>(.*?)</div><div class=""d_label""><b>播放:</b>(.*?)</div></p>.*?<p><b>看点:</b>(.*?)</p>.*?<p><b>简介:</b>(.*?)</p>.*?<p><b style=""color:#F00"">状态:</b>(.*?)</p>.*?</dd>.*?</dl>", RegexOptions.Singleline);
                }
                List <DiliModel> listModel = new List <DiliModel>();
                foreach (Match item in mc)
                {
                    listModel.Add(new DiliModel()
                    {
                        url       = item.Groups[1].Value,
                        title     = item.Groups[4].Value,
                        date      = item.Groups[6].Value,
                        area      = item.Groups[5].Value,
                        tag       = item.Groups[7].Value,
                        shortDesc = item.Groups[9].Value,
                        desc      = item.Groups[10].Value,
                        img       = item.Groups[2].Value
                    });
                }
                list_Info.ItemsSource = listModel;
            }
            catch (Exception)
            {
                messShow.Show("读取失败", 3000);
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
            }
        }
Example #24
0
        public static async Task <ReturnPlayModel> GetBilibiliBangumiUrl(PlayerModel model, int qn)
        {
            try
            {
                List <string> urls     = new List <string>();
                var           playList = new SYEngine.Playlist(SYEngine.PlaylistTypes.NetworkHttp);
                string        url2     = string.Format(
                    "https://bangumi.bilibili.com/player/web_api/v2/playurl?cid={1}&appkey={0}&otype=json&type=&quality={2}&module=bangumi&season_type=1&qn={2}&ts={3}", ApiHelper._appKey_VIDEO, model.Mid, qn, ApiHelper.GetTimeSpan_2);
                url2 += "&sign=" + ApiHelper.GetSign_VIDEO(url2);
                var re = await WebClientClass.GetResultsUTF8Encode(new Uri(url2));

                FlvPlyaerUrlModel m = JsonConvert.DeserializeObject <FlvPlyaerUrlModel>(re);
                //是否遇到了地区限制
                if (m.code == 0 && !re.Contains("8986943"))
                {
                    foreach (var item in m.durl)
                    {
                        urls.Add(item.url);
                        playList.Append(item.url, item.size, item.length / 1000);
                    }
                    playList.NetworkConfigs = CreatePlaylistNetworkConfigs("https://www.bilibili.com/bangumi/play/ep" + model.episode_id);
                    return(new ReturnPlayModel()
                    {
                        playlist = playList,
                        usePlayMode = UsePlayMode.SYEngine,
                        urls = urls,
                        from = "bilibili"
                    });
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
        private async void GetZan()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;

                string url = string.Format("http://message.bilibili.com/api/notify/query.praiseme.list.do?_device=android&&_ulv=10000&access_key={0}&actionKey=appkey&appkey={1}&build=518000&data_type=1&page_size=40&platform=android&ts={2}", ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan);
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                MessageReplyModel model = JsonConvert.DeserializeObject <MessageReplyModel>(results);
                if (model.code == 0)
                {
                    List <MessageReplyModel> list = JsonConvert.DeserializeObject <List <MessageReplyModel> >(model.data.ToString());
                    foreach (var item in list)
                    {
                        MessageReplyModel models = JsonConvert.DeserializeObject <MessageReplyModel>(item.publisher.ToString());
                        item.mid  = models.mid;
                        item.name = models.name;
                        item.face = models.face;
                    }
                    list_Zan.ItemsSource = list;
                }
                else
                {
                    Utils.ShowMessageToast("读取失败" + model.message, 3000);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("读取失败", 3000);
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #26
0
        private async void SearchAtList(string keyword)
        {
            try
            {
                pr_LoadSearchAt.Visibility = Visibility.Visible;
                string url = "https://app.bilibili.com/x/v2/search/user?_device=android&access_key={0}&appkey={1}&build=5250000&from_source=dynamic_uname&highlight=0&keyword={2}&order=totalrank&order_sort=0&platform=android&pn=0&ps=20&src=bilih5&ts={3}&user_type=0";
                url  = string.Format(url, ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, Uri.EscapeDataString(keyword), ApiHelper.GetTimeSpan_2);
                url += "&sign=" + ApiHelper.GetSign(url);
                var re = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                SearchAtListModel m = JsonConvert.DeserializeObject <SearchAtListModel>(re);
                if (m.code == 0)
                {
                    ls_SearchAt.ItemsSource = m.data.items;
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                pr_LoadSearchAt.Visibility = Visibility.Collapsed;
            }
        }
 private async void GetListInfo(string date)
 {
     try
     {
         pr_load.Visibility = Visibility.Visible;
         wc = new WebClientClass();
         string url = string.Format("http://www.dilidili.com/anime/{0}/", date);
         string results = await wc.GetResultsUTF8Encode(new Uri(url));
         MatchCollection mc = Regex.Matches(results, @"<div class=""item"">.*?<div class=""content"">.*?<div class=""title"">.*?<a href=""(.*?)"" target=""_blank"">(.*?)</a>.*?<span class=""data""><b>年代:</b>(.*?)</span>.*?</div>.*?<p><b>地区:</b>(.*?)</p>.*?<p><b>类型:</b>(.*?)</p>.*?<p><b>看点:</b>(.*?)</p>.*?<p><b>简介:</b>(.*?)</p>.*?</div>.*?<div class=""cover"">.*?<a href=""(.*?)"" target=""_blank"">.*?<img src=""(.*?)"">.*?</a>.*?</div>", RegexOptions.Singleline);
         List<DiliModel> listModel = new List<DiliModel>();
         foreach (Match item in mc)
         {
             listModel.Add(new DiliModel()
             {
                 url = item.Groups[1].Value,
                 title = item.Groups[2].Value,
                 date = item.Groups[3].Value,
                 area = item.Groups[4].Value,
                 tag = item.Groups[5].Value,
                 shortDesc = item.Groups[6].Value,
                 desc = item.Groups[7].Value,
                 img = item.Groups[9].Value
             });
         }
         list_Info.ItemsSource = listModel;
     }
     catch (Exception)
     {
         messShow.Show("读取失败",3000);
     }
     finally
     {
         pr_load.Visibility = Visibility.Collapsed;
     }
      
 }
Example #28
0
        private async void GetListInfo(string date)
        {
            try
            {
                pr_load.Visibility = Visibility.Visible;
                wc = new WebClientClass();
                string url     = string.Format("http://www.dilidili.com/anime/{0}/", date);
                string results = await wc.GetResultsUTF8Encode(new Uri(url));

                MatchCollection  mc        = Regex.Matches(results, @"<div class=""item"">.*?<div class=""content"">.*?<div class=""title"">.*?<a href=""(.*?)"" target=""_blank"">(.*?)</a>.*?<span class=""data""><b>年代:</b>(.*?)</span>.*?</div>.*?<p><b>地区:</b>(.*?)</p>.*?<p><b>类型:</b>(.*?)</p>.*?<p><b>看点:</b>(.*?)</p>.*?<p><b>简介:</b>(.*?)</p>.*?</div>.*?<div class=""cover"">.*?<a href=""(.*?)"" target=""_blank"">.*?<img src=""(.*?)"">.*?</a>.*?</div>", RegexOptions.Singleline);
                List <DiliModel> listModel = new List <DiliModel>();
                foreach (Match item in mc)
                {
                    listModel.Add(new DiliModel()
                    {
                        url       = item.Groups[1].Value,
                        title     = item.Groups[2].Value,
                        date      = item.Groups[3].Value,
                        area      = item.Groups[4].Value,
                        tag       = item.Groups[5].Value,
                        shortDesc = item.Groups[6].Value,
                        desc      = item.Groups[7].Value,
                        img       = item.Groups[9].Value
                    });
                }
                list_Info.ItemsSource = listModel;
            }
            catch (Exception)
            {
                messShow.Show("读取失败", 3000);
            }
            finally
            {
                pr_load.Visibility = Visibility.Collapsed;
            }
        }
Example #29
0
        private async void GetCos()
        {
            try
            {
                pr_Load.Visibility          = Visibility.Visible;
                btn_loadMoreDraw.Visibility = Visibility.Collapsed;
                _cosLoad = true;
                if (_cosPage == 0)
                {
                    gv_cos.ItemsSource = null;
                }
                var url = "http://api.vc.bilibili.com/link_draw/v2/Photo/index?appkey={1}&page_num={1}&page_size=20&platform=android&src=bilih5&ts={2}&type=recommend";
                switch (cb_draw.SelectedIndex)
                {
                case 0:
                    url = string.Format(url, ApiHelper._appKey, _cosPage, ApiHelper.GetTimeSpan);
                    break;

                case 1:
                    url = "http://api.vc.bilibili.com/link_draw/v2/Photo/list?appkey={0}&category={3}&page_num={1}&page_size=20&platform=android&type=hot&ts={2}";
                    url = string.Format(url, ApiHelper._appKey, _cosPage, ApiHelper.GetTimeSpan, "cos");
                    break;

                case 2:
                    url = "http://api.vc.bilibili.com/link_draw/v2/Photo/list?appkey={0}&category={3}&page_num={1}&page_size=20&platform=android&type=hot&ts={2}";
                    url = string.Format(url, ApiHelper._appKey, _cosPage, ApiHelper.GetTimeSpan, "sifu");
                    break;

                default:
                    break;
                }
                url += "&sign=" + ApiHelper.GetSign(url);

                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                AblumModel m = Newtonsoft.Json.JsonConvert.DeserializeObject <AblumModel>(results);
                if (m.code == 0)
                {
                    if (m.data.items != null && m.data.items.Count != 0)
                    {
                        btn_loadMoreCos.Visibility = Visibility.Visible;
                        if (gv_cos.ItemsSource == null)
                        {
                            gv_cos.ItemsSource = m.data.items;
                        }
                        else
                        {
                            var ls = gv_cos.ItemsSource as ObservableCollection <AblumModel>;
                            foreach (var item in m.data.items)
                            {
                                ls.Add(item);
                            }
                        }
                        _cosPage++;
                        btn_loadMoreCos.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        Utils.ShowMessageToast("加载完了");
                        btn_loadMoreCos.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    Utils.ShowMessageToast(m.message);
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("加载插画失败");
            }
            finally
            {
                _cosLoad           = false;
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Example #30
0
        public static async Task <List <QualityModel> > GetAnimeQualities(PlayerModel model)
        {
            List <QualityModel> qualities = new List <QualityModel>();

            try
            {
                var           qn   = 64;
                List <string> urls = new List <string>();

                string url2 = string.Format(
                    "https://bangumi.bilibili.com/player/web_api/v2/playurl?cid={1}&appkey={0}&otype=json&type=&quality={2}&module=bangumi&season_type=1&qn={2}&ts={3}", ApiHelper._appKey_VIDEO, model.Mid, qn, ApiHelper.GetTimeSpan_2);
                url2 += "&sign=" + ApiHelper.GetSign_VIDEO(url2);
                var re = await WebClientClass.GetResultsUTF8Encode(new Uri(url2));

                FlvPlyaerUrlModel m = JsonConvert.DeserializeObject <FlvPlyaerUrlModel>(re);
                if (m.code == 0 && !re.Contains("8986943"))
                {
                    foreach (var item in m.accept_description)
                    {
                        qualities.Add(new QualityModel()
                        {
                            description = item,
                            qn          = m.accept_quality[m.accept_description.IndexOf(item)]
                        });
                    }
                }
                else
                {
                    var re3 = await WebClientClass.GetResults(new Uri(string.Format("https://moe.nsapps.cn/api/v1/BiliAnimeUrl?animeid={0}&cid={1}&epid={2}&rnd={3}", model.banId, model.Mid, model.banInfo.episode_id, ApiHelper.GetTimeSpan)));

                    JObject obj = JObject.Parse(re3);
                    if (Convert.ToInt32(obj["code"].ToString()) == 0)
                    {
                        qualities.Add(new QualityModel()
                        {
                            description = "默认",
                            qn          = 80
                        });
                    }
                    else
                    {
                        return(new List <QualityModel>()
                        {
                            new QualityModel()
                            {
                                description = "流畅", qn = 32
                            },
                            new QualityModel()
                            {
                                description = "清晰", qn = 64
                            },
                            new QualityModel()
                            {
                                description = "高清", qn = 80
                            },
                            new QualityModel()
                            {
                                description = "超清", qn = 112
                            },
                        });
                    }
                }


                qualities = qualities.OrderBy(x => x.qn).ToList();
                return(qualities);
            }
            catch (Exception)
            {
                return(new List <QualityModel>()
                {
                    new QualityModel()
                    {
                        description = "流畅", qn = 32
                    },
                    new QualityModel()
                    {
                        description = "清晰", qn = 64
                    },
                    new QualityModel()
                    {
                        description = "高清", qn = 80
                    },
                    new QualityModel()
                    {
                        description = "超清", qn = 112
                    },
                });
            }
        }
Example #31
0
        private async void LoadDynamicData(string dynamic_id)
        {
            try
            {
                string url = string.Format("https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail?access_key={0}&appkey={1}&dynamic_id={2}&build=5250000&mobi_app=android&platform=android&src=bilih5&ts={3}", ApiHelper.AccessKey, ApiHelper.AndroidKey.Appkey, dynamic_id, ApiHelper.TimeStamp);
                url += "&sign=" + ApiHelper.GetSign(url);

                string re = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                JObject obj = JObject.Parse(re);
                if (obj["code"].ToInt32() == 0)
                {
                    DynamicCardsModel dynamicCardsModel = Newtonsoft.Json.JsonConvert.DeserializeObject <DynamicCardsModel>(obj["data"]["card"].ToString());
                    _data = dynamicCardsModel;
                    //_data = new DynamicCardsModel()
                    //{
                    //    feed1 = dynamicFeed1Model,
                    //    desc = new DynamicCardsModel()
                    //    {
                    //        timestamp = dynamicFeed1Model.item.upload_timestamp,
                    //        type = 2,
                    //        uid = dynamicFeed1Model.user.uid,
                    //        dynamic_id = Convert.ToInt64(dynamic_id),
                    //        user_profile = new user_profileModel()
                    //        {
                    //            info = new user_profileModel()
                    //            {
                    //                uid = dynamicFeed1Model.user.uid,
                    //                face = dynamicFeed1Model.user.head_url,
                    //                uname = dynamicFeed1Model.user.name
                    //            }
                    //        },
                    //        rid = dynamicFeed1Model.item.doc_id,

                    //        like = dynamicFeed1Model.item.vote_count,
                    //    },
                    //    reply = dynamicFeed1Model.item.comment_count,
                    //    card = obj["data"].ToString()
                    //};
                    ObservableCollection <DynamicCardsModel> ls = new ObservableCollection <DynamicCardsModel>();
                    ls.Add(_data);
                    dynamic.LoadData(ls, true);
                    ls_repost.ItemsSource = null;
                    if (_data.desc.user_profile != null)
                    {
                        if (_data.desc.user_profile.info.uid.ToString() == ApiHelper.GetUserId())
                        {
                            btn_Delete.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            btn_Delete.Visibility = Visibility.Collapsed;
                        }
                    }
                    LoadRepost();

                    comment.ClearComment();
                    InitializeComment();
                }
                else
                {
                    obj["message"].ToString();
                }
            }
            catch (Exception)
            {
                Utils.ShowMessageToast("无法读取动态");
            }
        }
Example #32
0
        private async void LaodTimeline()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                string url = "";
                switch (cb_OrderBy.SelectedIndex)
                {
                case 0:
                    url = string.Format("https://bangumi.bilibili.com/api/timeline_v4?access_key={0}&appkey={1}&area_id=1%2C2%2C-1&build=5250000&date_after=6&date_before=6&mobi_app=android&platform=wp&see_mine=0&ts={2}000", ApiHelper.access_key, ApiHelper._appKey, ApiHelper.GetTimeSpan);
                    break;

                case 1:
                    url = string.Format("https://bangumi.bilibili.com/api/timeline_v4?access_key={0}&appkey={1}&area_id=1%2C2%2C-1&build=5250000&date_after=6&date_before=6&mobi_app=android&platform=wp&see_mine=1&ts={2}000", ApiHelper.access_key, ApiHelper._appKey, ApiHelper.GetTimeSpan);
                    break;

                case 2:
                    url = string.Format("https://bangumi.bilibili.com/api/timeline_v4?access_key={0}&appkey={1}&area_id=2%2C-1&build=5250000&date_after=6&date_before=6&mobi_app=android&platform=wp&see_mine=0&ts={2}000", ApiHelper.access_key, ApiHelper._appKey, ApiHelper.GetTimeSpan);
                    break;

                case 3:
                    url = string.Format("https://bangumi.bilibili.com/api/timeline_v4?access_key={0}&appkey={1}&area_id=1%2C-1&build=5250000&date_after=6&date_before=6&mobi_app=android&platform=wp&see_mine=0&ts={2}000", ApiHelper.access_key, ApiHelper._appKey, ApiHelper.GetTimeSpan);
                    break;

                default:
                    break;
                }
                url += "&sign=" + ApiHelper.GetSign(url);
                string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url));

                TimeLineModel m = JsonConvert.DeserializeObject <TimeLineModel>(results);
                if (m.code == 0)
                {
                    AllTimeLineModel model = new AllTimeLineModel();
                    var t0 = GetWeek(DateTime.Now);
                    model.today = new AllTimeLineModel()
                    {
                        Week = t0[0], WeekStr = t0[1], Date = t0[2], ls = new List <TimeLineModel>()
                    };
                    var n0 = GetWeek(DateTime.Now.AddDays(1));
                    model.next1 = new AllTimeLineModel()
                    {
                        Week = n0[0], WeekStr = n0[1], Date = n0[2], ls = new List <TimeLineModel>()
                    };
                    var n1 = GetWeek(DateTime.Now.AddDays(2));
                    model.next2 = new AllTimeLineModel()
                    {
                        Week = n1[0], WeekStr = n1[1], Date = n1[2], ls = new List <TimeLineModel>()
                    };
                    var n2 = GetWeek(DateTime.Now.AddDays(3));
                    model.next3 = new AllTimeLineModel()
                    {
                        Week = n2[0], WeekStr = n2[1], Date = n2[2], ls = new List <TimeLineModel>()
                    };
                    var n3 = GetWeek(DateTime.Now.AddDays(4));
                    model.next4 = new AllTimeLineModel()
                    {
                        Week = n3[0], WeekStr = n3[1], Date = n3[2], ls = new List <TimeLineModel>()
                    };
                    var n4 = GetWeek(DateTime.Now.AddDays(5));
                    model.next5 = new AllTimeLineModel()
                    {
                        Week = n4[0], WeekStr = n4[1], Date = n4[2], ls = new List <TimeLineModel>()
                    };
                    var n5 = GetWeek(DateTime.Now.AddDays(6));
                    model.next6 = new AllTimeLineModel()
                    {
                        Week = n5[0], WeekStr = n5[1], Date = n5[2], ls = new List <TimeLineModel>()
                    };
                    var p0 = GetWeek(DateTime.Now.AddDays(-6));
                    model.per1 = new AllTimeLineModel()
                    {
                        Week = p0[0], WeekStr = p0[1], Date = p0[2], ls = new List <TimeLineModel>()
                    };
                    var p1 = GetWeek(DateTime.Now.AddDays(-5));
                    model.per2 = new AllTimeLineModel()
                    {
                        Week = p1[0], WeekStr = p1[1], Date = p1[2], ls = new List <TimeLineModel>()
                    };
                    var p2 = GetWeek(DateTime.Now.AddDays(-4));
                    model.per3 = new AllTimeLineModel()
                    {
                        Week = p2[0], WeekStr = p2[1], Date = p2[2], ls = new List <TimeLineModel>()
                    };
                    var p3 = GetWeek(DateTime.Now.AddDays(-3));
                    model.per4 = new AllTimeLineModel()
                    {
                        Week = p3[0], WeekStr = p3[1], Date = p3[2], ls = new List <TimeLineModel>()
                    };
                    var p4 = GetWeek(DateTime.Now.AddDays(-2));
                    model.per5 = new AllTimeLineModel()
                    {
                        Week = p4[0], WeekStr = p4[1], Date = p4[2], ls = new List <TimeLineModel>()
                    };
                    var p5 = GetWeek(DateTime.Now.AddDays(-1));
                    model.per6 = new AllTimeLineModel()
                    {
                        Week = p5[0], WeekStr = p5[1], Date = p5[2], ls = new List <TimeLineModel>()
                    };
                    foreach (var item in m.result)
                    {
                        DateTime dt = DateTime.Parse(item.pub_date).Date;
                        if (dt == DateTime.Now.Date)
                        {
                            model.today.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(-6).Date)
                        {
                            model.per1.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(-5).Date)
                        {
                            model.per2.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(-4).Date)
                        {
                            model.per3.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(-3).Date)
                        {
                            model.per4.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(-2).Date)
                        {
                            model.per5.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(-1).Date)
                        {
                            model.per6.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(1).Date)
                        {
                            model.next1.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(2).Date)
                        {
                            model.next2.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(3).Date)
                        {
                            model.next3.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(4).Date)
                        {
                            model.next4.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(5).Date)
                        {
                            model.next5.ls.Add(item);
                        }
                        if (dt == DateTime.Now.AddDays(6).Date)
                        {
                            model.next6.ls.Add(item);
                        }
                    }


                    this.DataContext = model;
                }
                else
                {
                    Utils.ShowMessageToast(m.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867 || ex.HResult == -2147012889)
                {
                    Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000);
                }
                else
                {
                    Utils.ShowMessageToast("读取放送表失败了", 3000);
                }
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
                await Task.Delay(1000);

                GeneralTransform generalTransform = st.TransformToVisual(gv_today);
                Point            point            = generalTransform.TransformPoint(new Point(0, 0));

                sv.ChangeView(null, Math.Abs(point.Y), null);
            }
        }