示例#1
0
        /// <summary>
        ///统一处理Url
        /// </summary>
        /// <param name="par"></param>
        public async static Task <bool> HandelUrl(string url)
        {
            /*
             * 视频
             * https://www.bilibili.com/video/av3905642
             * https://m.bilibili.com/video/av3905642.html
             * https://www.bilibili.com/playlist/video/pl688?aid=19827477
             * bilibili://video/19239064
             * bilibili://?av=4284663
             */

            var video = Utils.RegexMatch(url.Replace("aid", "av").Replace("/", "").Replace("=", ""), @"av(\d+)");

            if (video != "")
            {
                InfoNavigateToEvent(typeof(VideoViewPage), video);
                return(true);
            }
            video = Utils.RegexMatch(url, @"bilibili://video/(\d+)");
            if (video != "")
            {
                InfoNavigateToEvent(typeof(VideoViewPage), video);
                return(true);
            }

            /*
             * 番剧/影视
             * https://bangumi.bilibili.com/anime/21680
             * https://www.bilibili.com/bangumi/play/ss21715
             * https://www.bilibili.com/bangumi/play/ep150706
             * https://m.bilibili.com/bangumi/play/ep150706
             * http://m.bilibili.com/bangumi/play/ss21715
             * bilibili://bangumi/season/21715
             * https://bangumi.bilibili.com/movie/12364
             */

            var bangumi = Utils.RegexMatch(url.Replace("movie", "ss").Replace("anime", "ss").Replace("season", "ss").Replace("/", ""), @"ss(\d+)");

            if (bangumi != "")
            {
                InfoNavigateToEvent(typeof(BanInfoPage), bangumi);
                return(true);
            }
            bangumi = Utils.RegexMatch(url, @"ep(\d+)");
            if (bangumi != "")
            {
                InfoNavigateToEvent(typeof(BanInfoPage), await Utils.BangumiEpidToSid(bangumi));
                return(true);
            }


            /*
             * 点评
             * https://www.bilibili.com/bangumi/media/md11592/
             * https://bangumi.bilibili.com/review/media/11592
             * bilibili://pgc/review/11592
             */

            var review = Utils.RegexMatch(url.Replace("media", "md").Replace("review", "md").Replace("/", ""), @"md(\d+)");

            if (review != "")
            {
                //InfoNavigateToEvent(typeof(BanInfoPage), review);
                await new Windows.UI.Popups.MessageDialog("请求打开点评" + review).ShowAsync();
                return(true);
            }



            /*
             * 直播
             * http://live.bilibili.com/live/5619438.html
             * http://live.bilibili.com/h5/5619438
             * http://live.bilibili.com/5619438
             * bilibili://live/5619438
             */

            var live = Utils.RegexMatch(url.Replace("h5", "live").Replace("live.bilibili.com", "live").Replace("/", ""), @"live(\d+)");

            if (live != "")
            {
                if (!SettingHelper.IsPc())
                {
                    PlayNavigateToEvent(typeof(LiveRoomPage), live);
                }
                else
                {
                    PlayNavigateToEvent(typeof(LiveRoomPC), live);
                }
                return(true);
            }

            /*
             * 小视频
             * http://vc.bilibili.com/mobile/detail?vc=1399466&bilifrom=1
             * http://vc.bilibili.com/video/1357956
             * bilibili://clip/1399466
             */

            var clip = Utils.RegexMatch(url.Replace("vc=", "clip").Replace("vc.bilibili.com/video", "clip").Replace("/", ""), @"clip(\d+)");

            if (clip != "")
            {
                MiniVideoDialog miniVideoDialog = new MiniVideoDialog();
                miniVideoDialog.ShowAsync(clip);
                return(true);
            }


            /*
             * 专栏
             * http://www.bilibili.com/read/cv242568
             * https://www.bilibili.com/read/mobile/242568
             * bilibili://article/242568
             */

            var article = Utils.RegexMatch(url.Replace("read/mobile/", "article").Replace("read/cv", "article").Replace("/", ""), @"article(\d+)");

            if (article != "")
            {
                InfoNavigateToEvent(typeof(ArticleContentPage), "https://www.bilibili.com/read/app/" + article);
                return(true);
            }


            /*
             * 音频
             * https://m.bilibili.com/audio/au247991
             * bilibili://music/detail/247991
             */

            var music = Utils.RegexMatch(url.Replace("music/detail/", "au").Replace("/", ""), @"au(\d+)");

            if (music != "")
            {
                InfoNavigateToEvent(typeof(MusicInfoPage), music);
                return(true);
            }

            /*
             * 歌单
             * https://m.bilibili.com/audio/am78723
             * bilibili://music/menu/detail/78723
             */

            var musicmenu = Utils.RegexMatch(url.Replace("menu/detail/", "am").Replace("/", ""), @"am(\d+)");

            if (musicmenu != "")
            {
                InfoNavigateToEvent(typeof(MusicMenuPage), musicmenu);
                return(true);
            }


            /*
             * 相簿及动态
             * http://h.bilibili.com/ywh/h5/2403422
             * http://h.bilibili.com/2403422
             * bilibili://album/2403422
             * https://t.bilibili.com/84935538081511530
             */
            var album = Utils.RegexMatch(url.Replace("h.bilibili.com/ywh/h5/", "album").Replace("h.bilibili.com", "album").Replace("t.bilibili.com", "album").Replace("/", ""), @"album(\d+)");

            if (album != "")
            {
                InfoNavigateToEvent(typeof(DynamicInfoPage), album);
                return(true);
            }


            /*
             * 用户中心
             * http://space.bilibili.com/7251681
             * https://m.bilibili.com/space/7251681
             * https://space.bilibili.com/1360010
             * bilibili://author/2622476
             */
            var user = Utils.RegexMatch(url.Replace("space.bilibili.com", "space").Replace("author", "space").Replace("/", ""), @"space(\d+)");

            if (user != "")
            {
                InfoNavigateToEvent(typeof(UserInfoPage), user);
                return(true);
            }

            /*
             * 话题/频道
             * https://www.bilibili.com/tag/7868838/feed
             * bilibili://tag/0/?name=bilibili%e5%a5%bd%e4%b9%a1%e9%9f%b3
             */
            var topic = Utils.RegexMatch(url, @"tag/(.*?)/feed");

            if (topic != "")
            {
                InfoNavigateToEvent(typeof(DynamicTopicPage), new object[] { "", topic });
                return(true);
            }
            var topic1 = Utils.RegexMatch(url + "/", @"tag/.*?/\?name=(.*?)/");

            if (topic1 != "")
            {
                var data = Uri.UnescapeDataString(topic1);
                InfoNavigateToEvent(typeof(DynamicTopicPage), new object[] { data, "" });
                return(true);
            }


            /*
             * 播单
             * https://www.bilibili.com/playlist/detail/pl792
             */


            /*
             * 投稿
             * bilibili://uper/user_center/add_archive/
             */
            var add_archive = url.Contains("/add_archive");

            if (add_archive)
            {
                //InfoNavigateToEvent(typeof(DynamicTopicPage), new object[] { "", topic });
                InfoNavigateToEvent(typeof(WebPage), new object[] { "https://member.bilibili.com/v2#/upload/video/frame" });
                return(true);
            }

            return(false);
        }
示例#2
0
        public static void ShowMiniVideo(string vid)
        {
            MiniVideoDialog miniVideoDialog = new MiniVideoDialog();

            miniVideoDialog.ShowAsync(vid);
        }