public static void Process() { var Dr = SeleniumFactory.GetFirefoxDriver(); var Account = new Data.StreamlineAccount() { Login = "******", Password = "******" }; StreamlineQuickBook.Process(Dr, Account, null, true); }
public static void ProductionProcess() { var Dr = SeleniumFactory.GetFirefoxDriver(); var Account = new Data.StreamlineAccount() { Login = "******", Password = "******" }; StreamlineLogin.Process(Dr, Account, false); }
public static void Process() { var Dr = SeleniumFactory.GetFirefoxDriver(); var Account = Data.AirBnbAccounts.GetAccountByEmail("*****@*****.**"); //AirBnbScrapeReservation.Process(Dr, Account, true); var Items = PageProcesser.AirBnb.AirBnbScrapeReservation.GetAllReservationItems(Dr, true); var Item = PageProcesser.AirBnb.AirBnbScrapeReservation.GetFullReservationInfo(Items[0], Dr, Account, true); Console.Write(Item.ToJson()); Console.Read(); }
static void Main(string[] args) { Config.I.UseProxy = true; AirBnbAccounts.Load(); var map = AirBnbRoomMap.Load(); foreach (var airAccount in AirBnbAccounts.Accounts) { if (map.GetAccount(airAccount.Email) != null) { N.Note(airAccount.Email + " skiped"); continue; } for (var proxyNum = 0; proxyNum < 1; proxyNum++) { var email = airAccount.Email; N.Note("Processing account " + email + " with proxy " + airAccount.ProxyAddress[proxyNum]); var profile = SeleniumProxy.GetFirefoxProfileWithProxy(airAccount.ProxyAddress, proxyNum); var driver = SeleniumFactory.GetFirefoxDriver(profile); try { var signInSucceed = AirBnbLogin.Process(driver, airAccount); if (signInSucceed.Status == AirBnbLoginStatus.Failed) { N.Note("Password for " + email + " is wrong or account unreachable"); try { driver.Quit(); } catch { } break; } var item = AirBnbScrapeRooms.GetRoomList(driver, airAccount); map.List.Add(item); driver.Quit(); } catch (Exception e) { N.Note("Error " + airAccount.Email + " : " + e + "".Substring(0, 100) + "..."); driver.Quit(); } } } map.Save(); }
static void Main(string[] args) { Console.WriteLine("SenStay Streamline Scraper"); Config.I.UseProxy = true; Config.I.RegularWaitSeconds = 30; Temp.TouchDirectory(Config.I.ImagesFolder); var account = new StreamlineAccount { Login = "******", Password = "******" }; using (var driver = SeleniumFactory.GetFirefoxDriver()) { try { StreamlineLogin.Process(driver, account); /////////////KILLL IT StreamlineSeasonProcesser.ScrapeSeasons(driver, "21713"); return; /////////////KILLL IT if (args.Length > 0) { if (args[0] == "seasons") { //StreamlineSeasonProcesser.ScrapeSeasons(driver, "20250"); //StreamlineSeasonProcesser.ScrapeSeasons(driver, "20826"); StreamlineSeasonProcesser.ScrapeSeasons(driver, "21713"); } if (args[0] == "additional") { StreamlineScrapeUnits.Process(driver, true); } } else { StreamlineScrapeUnits.Process(driver, false); } } catch (Exception ex) { Console.WriteLine(ex + ""); } } }
public static void RunCommands() { try { //Price var Account = new StreamlineAccount { Login = "******", Password = "******" }; var scripts = PriceScript.LoadAllScripts(); foreach (var script in scripts) { IWebDriver driver = null; try { driver = SeleniumFactory.GetFirefoxDriver(); driver.JustWait(1); N.Note("Run PriceScript for " + script.UnitId + " generated at " + script.Generated); StreamlineLogin.Process(driver, Account, false); driver.Manage().Window.Maximize(); StreamlineDailyPrice.RunPriceScript(driver, script); driver.JustWait(1); driver.Quit(); script.Archive(); } catch (Exception e) { N.Note(e + ""); } finally { if (driver != null) { driver.Quit(); } } } } catch { } }
static void Main(string[] args) { Console.WriteLine("Pricing sync for AirBnb"); Config.I.UseProxy = true; AirBnbAccounts.Load(); var roomsMap = AirBnbRoomMap.Load(); var streamlineCollection = StreamlinePropertyCollection.Load(); PropertyMap.SetMap(roomsMap, streamlineCollection); var property = PropertyMap.GetBySenstayID("LA029"); var proxyNum = 0; var airAccount = AirBnbAccounts.GetAccountByEmail(property.AirbnbAccountEmail); var email = airAccount.Email; N.Note("Processing account " + email + " with proxy " + airAccount.ProxyAddress[proxyNum]); var profile = SeleniumProxy.GetFirefoxProfileWithProxy(airAccount.ProxyAddress, proxyNum); using (var driver = SeleniumFactory.GetFirefoxDriver(profile)) { var signInSucceed = AirBnbLogin.Process(driver, airAccount); if (signInSucceed.Status != AirBnbLoginStatus.Sucess) { N.Note("Password for " + email + " is wrong or account unreachable"); try { driver.Quit(); } catch { // ignored } } AirBnbCalendar.SetPricesForUnit(driver, property, AirbnbUnitDailyPriceList.Load()); } }
static void Main(string[] args) { //Config.I.UseProxy = false; Config.I.UseProxy = true; DataInit.Init(); //debug(); //return; //var Account = Data.AirBnbAccounts.GetAccountByEmail("*****@*****.**"); var account = AirBnbAccounts.GetAccountByEmail("*****@*****.**"); var profile = SeleniumProxy.GetFirefoxProfileWithProxy(account.ProxyAddress); var driver = SeleniumFactory.GetFirefoxDriver(profile); AirBnbLogin.Process(driver, account); var items = AirBnbScrapeReservation.GetAllReservationItems(driver); AirBnbScrapeReservation.GetFullReservationInfo(items[0], driver, account); driver.Quit(); }
public static void PushPriceToStreamLine(DateTime processStartTime, OperationsJsonLogger <PricePushResult> pricePushLogger, List <Property> streamLineProperties) { try { using (RemoteWebDriver driver = SeleniumFactory.GetFirefoxDriver(null)) { // Login to the streamline system. StreamlineAccount streamLineAccount = new StreamlineAccount(); streamLineAccount.Login = Config.I.StreamLineAccountLogin; streamLineAccount.Password = Config.I.StreamLineAccountPassword; N.Note("Trying to login with the user :"******"Login succeeded"); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); wait.Until(ExpectedConditions.ElementExists(By.Id("menu"))); N.Note("Check whether news dialog has popped up"); // Close the dialog which pop's up as soon as you login. StreamlineLogin.CheckNewsDialogPopup(driver); N.Note("Create season group"); List <Season> streamLineSeasons = new List <Season>(); string groupId = StreamlineSeasonProcesser.CreateSeasonGroup(driver, processStartTime); if (!string.IsNullOrEmpty(groupId) && groupId != "0") { N.Note("Created Group :" + StreamlineSeasonProcesser.GetSeasonGroupName(processStartTime)); // Filter the rates based on the valid dates N.Note("Filtering the valid property prices"); var validPropertyPrices = streamLineProperties[0].Prices.Where(x => x.SeasonEndDate > DateTime.UtcNow).ToList(); N.Note("Create Seasons for the season group"); foreach (Price season in validPropertyPrices) { Thread.Sleep(TimeSpan.FromSeconds(1)); var seasonId = StreamlineSeasonProcesser.CreateSeason(driver, groupId, season.SeasonStartDate, season.SeasonEndDate, season.MinimumLos); if (!string.IsNullOrEmpty(seasonId) && seasonId != "0") { N.Note("Created Season : " + StreamlineSeasonProcesser.GetSeasonName(season.SeasonStartDate, season.SeasonEndDate)); streamLineSeasons.Add(new Season { SeasonStartDate = season.SeasonStartDate, SeasonEndDate = season.SeasonEndDate, SeasonId = seasonId }); //season.SeasonId = seasonId; } else { pricePushLogger.Log(new PricePushResult(Channel.StreamLine, PricePushLogArea.Season, PricingPushLogType.Error, "Season was not created for the dates starting with " + season.SeasonStartDate.ToShortDateString() + " and ending with " + season.SeasonEndDate.ToShortDateString() + " for the season group" + StreamlineSeasonProcesser.GetSeasonGroupName(processStartTime))); } } } else { pricePushLogger.Log(new PricePushResult( Channel.StreamLine, PricePushLogArea.SeasonGroup, PricingPushLogType.Error, "Season group was not created : " + StreamlineSeasonProcesser.GetSeasonGroupName(processStartTime))); } foreach (Property streamLineProperty in streamLineProperties) { N.Note("Check whether property exists : " + streamLineProperty.StreamLineHomeName); // Check whether the property exists in streamline or not. if (StreamlineDailyPrice.CheckWhetherPropertyExists(driver, streamLineProperty.StreamLineHomeId)) { N.Note("Changing the default season group for the property to the new one"); if (StreamlineSeasonProcesser.ChangeSeasonGroup(driver, streamLineProperty.StreamLineHomeId, streamLineProperty.StreamLineHomeName, groupId)) { N.Note("Default season group changed successfully"); // Map the season id's to the corresponding season in the property foreach (Season season in streamLineSeasons) { var mappedPropertySeason = streamLineProperty.Prices.FirstOrDefault(p => p.SeasonStartDate == season.SeasonStartDate && p.SeasonEndDate == season.SeasonEndDate); if (mappedPropertySeason != null) { mappedPropertySeason.SeasonId = season.SeasonId; } } N.Note("Update season price for the unit"); StreamlineDailyPrice.SetPricesForUnit(driver, Convert.ToInt32(streamLineProperty.StreamLineHomeId), streamLineProperty.Prices, pricePushLogger); } else { N.Note("Changing the default season group failed"); pricePushLogger.Log(new PricePushResult( Channel.StreamLine, PricePushLogArea.Property, PricingPushLogType.Error, "The process was not able to update the default Season group of the property : " + streamLineProperty.StreamLineHomeName, Config.I.StreamLineAccountLogin, streamLineProperty.StreamLineHomeId, string.Empty, streamLineProperty.StreamLineHomeName, streamLineProperty.PropertyCode, string.Empty, string.Empty, string.Empty)); } } else { pricePushLogger.Log(new PricePushResult( Channel.StreamLine, PricePushLogArea.Property, PricingPushLogType.Error, "The property was not found in Streamline : " + streamLineProperty.StreamLineHomeName, streamLineAccount.Login, streamLineProperty.StreamLineHomeId, string.Empty, streamLineProperty.StreamLineHomeName, streamLineProperty.PropertyCode, string.Empty, string.Empty, string.Empty)); } } } else { pricePushLogger.Log(new PricePushResult( Channel.StreamLine, PricePushLogArea.Login, PricingPushLogType.Error, "Login failed for the user : "******"Pricing push to Streamline failed", ex.Message)); } }
internal void DownloadTransactions() { _logger.Info("preparing locks"); var account = _airAccount; var email = account.Email; var date = DateTime.Now; var lockHash = date.ToString("yyyy\\MMMM-d") + @"\" + email; var lockHashSuccess = lockHash + "-sucess"; if (Temp.IsLocked(lockHashSuccess)) { _logger.Info(string.Format("{0} is processed already", email)); N.Note(email + " skiped"); return; } foreach (var proxy in account.ProxyAddress) { var lockHashLoginError = string.Format("{0}-{1}-loginerror", lockHash, proxy.Replace(":", "-")); _logger.Info(string.Format("Processing account {0} with proxy {1}", email, proxy)); N.Note("Processing account " + email + " with proxy " + proxy); if (Temp.IsLocked(lockHashLoginError)) { _logger.Info(string.Format("{0} with proxy {1} is locked because of incorrect password", email, proxy)); N.Note(email + " (wrong password record)"); continue; } var profile = SeleniumProxy.GetFirefoxProfileWithProxy(proxy); _logger.Info("Prepare profile for downloading"); AirBnbTransactionHistory.PrepareProfileForDownloading(profile); try { _logger.Info("Creating driver"); using (var driver = SeleniumFactory.GetFirefoxDriver(profile)) { _logger.Info("Signing in"); var signInSucceed = AirBnbLogin.Process(driver, account); _logger.Info(string.Format("Sign in result: {0}", signInSucceed)); _loginAttemptsProcessor.Log(new LoginAttempt(email, signInSucceed.Status, signInSucceed.Message, proxy)); switch (signInSucceed.Status) { case AirBnbLoginStatus.Failed: case AirBnbLoginStatus.Unable: case AirBnbLoginStatus.VerifyUser: case AirBnbLoginStatus.VerifyBrowser: N.Note("Password for " + email + " is wrong or account unreachable"); Temp.Lock(lockHashLoginError); continue; case AirBnbLoginStatus.Sucess: break; case AirBnbLoginStatus.ProxyError: break; case AirBnbLoginStatus.PageError: break; default: throw new ArgumentOutOfRangeException(); } _logger.Info("Prepare profile for downloading"); var completedLoadResult = LoadCompletedCsv(driver, date, email); _logger.Info("Prepare profile for downloading"); var pendingLoadResult = LoadPendingCsv(driver, date, email); if (!completedLoadResult || !pendingLoadResult) { continue; } Temp.Lock(lockHashSuccess); _logger.InfoFormat("Account {0} is locked", account.Email); break; } } catch (Exception ex) { _logger.Error(string.Format("Error while processing {0} with proxy {1}", account.Email, proxy), ex); N.Note(email + " exception " + (ex + "").Substring(0, 70) + "..."); } } }