private void GetProfilePosts(string path) { _userProfilePage.ScrollDownUntil(() => _userProfilePage.GetPostsCount(), _postsCount); var allPosts = _userProfilePage.GetPostsByCount(_postsCount); allPosts.ForEach(post => { post.Add("Item_ID", Guid.NewGuid().ToString()); post.Add("Profile_Url", _userProfilePage.GetPageUrl()); post.Add("Data_Type", "Post"); }); SerDeUtils.SerializeToJsonFile(allPosts, path); }
public void SaveBotState() { if (!String.IsNullOrEmpty(_botStateBackupDir)) { var savePath = Path.Combine(_botStateBackupDir, _botStateFileName); SerDeUtils.SerializeToJsonFile(_botState, savePath); _logger.Info($"BotState successfully saved: {savePath}"); } else { _logger.Warn($"Can't save BotState, bad path: {_botStateBackupDir}"); } }
public override void Process(BotStateBuilder botState) { botState.ComponentsDataHandler.Add(this.GetType().Name, _searchResults); foreach (var link in _searchLinks) { _searchResultsPage.SetPageUrl(link.Value); _searchResultsPage.GoToPageUrl(); _searchResultsPage.GoToPageUrl(); _searchResultsPage.ScrollDownToPageEnd(); _searchResults.Add(link.Key, _searchResultsPage.GetAllProfilesUrls()); Configs.Logger.Info($"Resuls for link: {link.Key} was added to list"); } SerDeUtils.SerializeToJsonFile(_searchResults, ResultsOutputPath); }
private void GetProfileInfo(string path) { var fields = new Dictionary <string, object> { { "Item_ID", Guid.NewGuid().ToString() }, { "Profile_Url", _userProfilePage.GetPageUrl() }, { "Data_Type", "ProfileInfo" }, { "Full_Name", _userProfilePage.GetFullName() } }; fields.AddRange(_userProfilePage.GetProfileInfoFields()); SerDeUtils.SerializeToJsonFile(fields, path); }