public string GetYoutubeSearchData(string Url)
        {
            try
            {
                string youtubesearchurl = "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=15&order=relevance&q=" + Url + "&key=" + ConfigurationManager.AppSettings["Api_Key"];
                string response = WebRequst(youtubesearchurl);
                var Jdata = Newtonsoft.Json.Linq.JObject.Parse(response);

                foreach (var item in Jdata["items"])
                {

                    Domain.Socioboard.MongoDomain.ArticlesAndBlogs _ArticlesAndBlogs = new Domain.Socioboard.MongoDomain.ArticlesAndBlogs();
                    _ArticlesAndBlogs.Id = ObjectId.GenerateNewId();
                    _ArticlesAndBlogs.Type = "youtube";
                    _ArticlesAndBlogs.HostName = Url;
                  
                    try
                    {
                        _ArticlesAndBlogs.VideoId = item["id"]["videoId"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        logger.Error(ex.Message);
                        _ArticlesAndBlogs.VideoId = "";
                    }

                    if (!string.IsNullOrEmpty(_ArticlesAndBlogs.VideoId))
                    {
                        try
                        {
                            _ArticlesAndBlogs.VideoUrl = "https://www.youtube.com/watch?v="+_ArticlesAndBlogs.VideoId;
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.VideoUrl = "";
                        }
                        _ArticlesAndBlogs.Url = Url;
                        try
                        {
                            _ArticlesAndBlogs.Title = item["snippet"]["title"].ToString();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.Title = "";
                        }
                        try
                        {
                            _ArticlesAndBlogs.Description = item["snippet"]["description"].ToString();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.Description = "";
                        }
                        try
                        {
                            _ArticlesAndBlogs.Created_Time = (DateTime.Parse(item["snippet"]["publishedAt"].ToString())).ToUnixTimestamp();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.Created_Time = DateTime.UtcNow.ToUnixTimestamp();
                        }

                        var ret = ArticlesAndBlogsRepo.Find<Domain.Socioboard.MongoDomain.ArticlesAndBlogs>(t => t.VideoId.Equals(_ArticlesAndBlogs.VideoId) && t.Type.Equals(_ArticlesAndBlogs.Type));
                        var task = Task.Run(async () =>
                        {
                            return await ret;
                        });
                        int count = task.Result.Count;
                        if (count < 1)
                        {
                            ArticlesAndBlogsRepo.Add(_ArticlesAndBlogs);
                        } 
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("GetYoutubeSearchData = > " + ex.Message);
            }

            return "Successfully updated";
        }
        public string DailyMotionPost(string Url)
        {
            try
            {
                string _dailymotionpostRestUrl = "https://api.dailymotion.com/videos/?search=" + Url + "&fields=id,title,created_time,url,description";

                string response = WebRequst(_dailymotionpostRestUrl);

                var jdata = Newtonsoft.Json.Linq.JObject.Parse(response);

                foreach (var item in jdata["list"])
                {
                    Domain.Socioboard.MongoDomain.ArticlesAndBlogs _ArticlesAndBlogs = new Domain.Socioboard.MongoDomain.ArticlesAndBlogs();
                    _ArticlesAndBlogs.Id = ObjectId.GenerateNewId();
                    _ArticlesAndBlogs.Type = "dailymotion";
                    _ArticlesAndBlogs.HostName = Url;
                    
                    try
                    {
                        _ArticlesAndBlogs.VideoId = item["id"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.VideoId = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.Title = item["title"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.Title = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.VideoUrl = item["url"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.VideoUrl = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.Description = item["description"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.Description = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.Created_Time =long.Parse(item["created_time"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.Created_Time = DateTime.UtcNow.ToUnixTimestamp();
                    }
                    _ArticlesAndBlogs.Url = Url;
                    var ret = ArticlesAndBlogsRepo.Find<Domain.Socioboard.MongoDomain.ArticlesAndBlogs>(t => t.VideoId.Equals(_ArticlesAndBlogs.VideoId) && t.Type.Equals(_ArticlesAndBlogs.Type));
                    var task = Task.Run(async () =>
                    {
                        return await ret;
                    });
                    int count = task.Result.Count;
                    if (count < 1)
                    {
                        ArticlesAndBlogsRepo.Add(_ArticlesAndBlogs);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("DailyMotionPost => " + ex.Message);
            }
            return "Successfully updated";


        }
        public string GetYouTubeVideoData(string Url)
        {
            var Jdata = GetYoutubeVideo(Url);

            foreach (var item in Jdata["responseData"]["results"])
            {
                Domain.Socioboard.MongoDomain.ArticlesAndBlogs _ArticlesAndBlogs = new Domain.Socioboard.MongoDomain.ArticlesAndBlogs();
                _ArticlesAndBlogs.Id = ObjectId.GenerateNewId();

                _ArticlesAndBlogs.Url = Url;
                try
                {
                    _ArticlesAndBlogs.Title = item["titleNoFormatting"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                    logger.Error(ex.StackTrace);
                    _ArticlesAndBlogs.Title = "";
                }
                try
                {
                    _ArticlesAndBlogs.Created_Time = (DateTime.Parse(item["published"].ToString())).ToUnixTimestamp();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.Created_Time = DateTime.UtcNow.ToUnixTimestamp();
                }
                try
                {
                    _ArticlesAndBlogs.Description = item["content"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.Description = "";
                }

                try
                {
                    _ArticlesAndBlogs.VideoId = item["url"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.VideoId = "";
                }
                try
                {
                    _ArticlesAndBlogs.VideoUrl = item["url"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.VideoUrl = "";
                }
                var ret  = ArticlesAndBlogsRepo.Find <Domain.Socioboard.MongoDomain.ArticlesAndBlogs>(t => t.VideoId.Equals(_ArticlesAndBlogs.VideoId));
                var task = Task.Run(async() =>
                {
                    return(await ret);
                });
                int count = task.Result.Count;
                if (count < 1)
                {
                    ArticlesAndBlogsRepo.Add(_ArticlesAndBlogs);
                }
            }
            return("Successfully updated");
        }
        public string GetYouTubeVideoData(string Url) 
        {
            var Jdata = GetYoutubeVideo(Url);
            foreach (var item in Jdata["responseData"]["results"])
            {
                Domain.Socioboard.MongoDomain.ArticlesAndBlogs _ArticlesAndBlogs = new Domain.Socioboard.MongoDomain.ArticlesAndBlogs();
                _ArticlesAndBlogs.Id = ObjectId.GenerateNewId();
              
                _ArticlesAndBlogs.Url = Url;
                try
                {
                    _ArticlesAndBlogs.Title = item["titleNoFormatting"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                    logger.Error(ex.StackTrace);
                    _ArticlesAndBlogs.Title = "";
                }
                try
                {
                    _ArticlesAndBlogs.Created_Time = (DateTime.Parse(item["published"].ToString())).ToUnixTimestamp();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.Created_Time = DateTime.UtcNow.ToUnixTimestamp();
                }
                try
                {
                    _ArticlesAndBlogs.Description = item["content"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.Description = "";
                }

                try
                {
                    _ArticlesAndBlogs.VideoId = item["url"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.VideoId = "";
                }
                try
                {
                    _ArticlesAndBlogs.VideoUrl = item["url"].ToString();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    logger.Error(ex.Message);
                    _ArticlesAndBlogs.VideoUrl = "";
                }
                var ret = ArticlesAndBlogsRepo.Find<Domain.Socioboard.MongoDomain.ArticlesAndBlogs>(t => t.VideoId.Equals(_ArticlesAndBlogs.VideoId));
                var task = Task.Run(async () =>
                {
                    return await ret;

                });
                int count = task.Result.Count;
                if (count < 1)
                {

                    ArticlesAndBlogsRepo.Add(_ArticlesAndBlogs);
                }
            }
            return "Successfully updated";
        }
        public string GetYoutubeSearchData(string Url)
        {
            try
            {
                string youtubesearchurl = "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=15&order=relevance&q=" + Url + "&key=" + ConfigurationManager.AppSettings["Api_Key"];
                string response         = WebRequst(youtubesearchurl);
                var    Jdata            = Newtonsoft.Json.Linq.JObject.Parse(response);

                foreach (var item in Jdata["items"])
                {
                    Domain.Socioboard.MongoDomain.ArticlesAndBlogs _ArticlesAndBlogs = new Domain.Socioboard.MongoDomain.ArticlesAndBlogs();
                    _ArticlesAndBlogs.Id       = ObjectId.GenerateNewId();
                    _ArticlesAndBlogs.Type     = "youtube";
                    _ArticlesAndBlogs.HostName = Url;

                    try
                    {
                        _ArticlesAndBlogs.VideoId = item["id"]["videoId"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        logger.Error(ex.Message);
                        _ArticlesAndBlogs.VideoId = "";
                    }

                    if (!string.IsNullOrEmpty(_ArticlesAndBlogs.VideoId))
                    {
                        try
                        {
                            _ArticlesAndBlogs.VideoUrl = "https://www.youtube.com/watch?v=" + _ArticlesAndBlogs.VideoId;
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.VideoUrl = "";
                        }
                        _ArticlesAndBlogs.Url = Url;
                        try
                        {
                            _ArticlesAndBlogs.Title = item["snippet"]["title"].ToString();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.Title = "";
                        }
                        try
                        {
                            _ArticlesAndBlogs.Description = item["snippet"]["description"].ToString();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.Description = "";
                        }
                        try
                        {
                            _ArticlesAndBlogs.Created_Time = (DateTime.Parse(item["snippet"]["publishedAt"].ToString())).ToUnixTimestamp();
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                            logger.Error(ex.Message);
                            _ArticlesAndBlogs.Created_Time = DateTime.UtcNow.ToUnixTimestamp();
                        }

                        var ret  = ArticlesAndBlogsRepo.Find <Domain.Socioboard.MongoDomain.ArticlesAndBlogs>(t => t.VideoId.Equals(_ArticlesAndBlogs.VideoId) && t.Type.Equals(_ArticlesAndBlogs.Type));
                        var task = Task.Run(async() =>
                        {
                            return(await ret);
                        });
                        int count = task.Result.Count;
                        if (count < 1)
                        {
                            ArticlesAndBlogsRepo.Add(_ArticlesAndBlogs);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("GetYoutubeSearchData = > " + ex.Message);
            }

            return("Successfully updated");
        }
        public string DailyMotionPost(string Url)
        {
            try
            {
                string _dailymotionpostRestUrl = "https://api.dailymotion.com/videos/?search=" + Url + "&fields=id,title,created_time,url,description";

                string response = WebRequst(_dailymotionpostRestUrl);

                var jdata = Newtonsoft.Json.Linq.JObject.Parse(response);

                foreach (var item in jdata["list"])
                {
                    Domain.Socioboard.MongoDomain.ArticlesAndBlogs _ArticlesAndBlogs = new Domain.Socioboard.MongoDomain.ArticlesAndBlogs();
                    _ArticlesAndBlogs.Id       = ObjectId.GenerateNewId();
                    _ArticlesAndBlogs.Type     = "dailymotion";
                    _ArticlesAndBlogs.HostName = Url;

                    try
                    {
                        _ArticlesAndBlogs.VideoId = item["id"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.VideoId = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.Title = item["title"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.Title = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.VideoUrl = item["url"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.VideoUrl = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.Description = item["description"].ToString();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.Description = "";
                    }
                    try
                    {
                        _ArticlesAndBlogs.Created_Time = long.Parse(item["created_time"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                        _ArticlesAndBlogs.Created_Time = DateTime.UtcNow.ToUnixTimestamp();
                    }
                    _ArticlesAndBlogs.Url = Url;
                    var ret  = ArticlesAndBlogsRepo.Find <Domain.Socioboard.MongoDomain.ArticlesAndBlogs>(t => t.VideoId.Equals(_ArticlesAndBlogs.VideoId) && t.Type.Equals(_ArticlesAndBlogs.Type));
                    var task = Task.Run(async() =>
                    {
                        return(await ret);
                    });
                    int count = task.Result.Count;
                    if (count < 1)
                    {
                        ArticlesAndBlogsRepo.Add(_ArticlesAndBlogs);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("DailyMotionPost => " + ex.Message);
            }
            return("Successfully updated");
        }