Skip to content

Commit

Permalink
Merge pull request #13 from pmahend1/dev
Browse files Browse the repository at this point in the history
small changes
  • Loading branch information
pmahend1 authored Feb 21, 2021
2 parents 4754503 + 52d6368 commit 835f3f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .Net Core/MSRewards/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static class Constants

public const string UserAgentKey = "general.useragent.override";

public const string MobileUserAgent = @"Mozilla/5.0 (Android 10; Mobile; rv:81.0) Gecko/81.0 Firefox/81.0";
public const string MobileUserAgent = @"Mozilla/5.0 (Android 10; Mobile; rv:86.0) Gecko/81.0 Firefox/86.0";

public const string PrivateBrowsingKey = "browser.privatebrowsing.autostart";

Expand Down
10 changes: 4 additions & 6 deletions .Net Core/MSRewards/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace MSRewards
{
internal class Program
{
static Random rand = new Random();
private static async Task RunOptions(Options opts)
{
email = opts.Email;
Expand Down Expand Up @@ -234,7 +235,7 @@ private async Task BingSearchAsync(RewardType rewardType, int current, int targe
{
try
{
var rand = new Random();

wordList = await DownloadJsonDataAsync<List<string>>(Constants.WordsListUrl);

//Edge browser
Expand Down Expand Up @@ -296,7 +297,7 @@ private async Task BingSearchAsync(RewardType rewardType, int current, int targe

while (current < target)
{
var nextInt = rand.Next(wordList.Count);
var nextInt = rand.Next(wordList.Count+1);
Search(edgeDriver, edgeWait, Constants.BingSearchURL + wordList[nextInt <= wordList.Count ? nextInt : 0]);
current += 5;
if (current >= target)
Expand All @@ -319,10 +320,7 @@ private async Task BingSearchAsync(RewardType rewardType, int current, int targe
var options = new FirefoxOptions();
TimeSpan timeout = TimeSpan.FromSeconds(60);
if (rewardType == RewardType.Mobile)
{
options.SetPreference(Constants.UserAgentKey, Constants.MobileUserAgent);
timeout = TimeSpan.FromSeconds(30);
}

options.SetPreference(Constants.PrivateBrowsingKey, true);
using (var firefoxDriver = new FirefoxDriver(options))
Expand Down Expand Up @@ -372,7 +370,7 @@ private async Task BingSearchAsync(RewardType rewardType, int current, int targe

while (current < target)
{
var nextInt = rand.Next(wordList.Count);
var nextInt = rand.Next(wordList.Count+1);
Search(firefoxDriver, driverWait, Constants.BingSearchURL + wordList[nextInt <= wordList.Count ? nextInt : 0]);
current += 5;
if (current >= target)
Expand Down

0 comments on commit 835f3f3

Please sign in to comment.