Skip to content

Commit

Permalink
Add --bing flag; increase default searches count and search delay (#41)
Browse files Browse the repository at this point in the history
* Add flag if default search engine is Bing

* Increase default search count and search delay
  • Loading branch information
znarfm authored Mar 20, 2024
1 parent 72ade8f commit 371c13c
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions bing_rewards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@


# Number of searches to make
DESKTOP_COUNT = 30
MOBILE_COUNT = 20
DESKTOP_COUNT = 33
MOBILE_COUNT = 23

# Time to allow Chrome to load in seconds
LOAD_DELAY = 1.5
# Time between searches in seconds
SEARCH_DELAY = 2
# Searches does not count if they are done earlier than ~6 seconds
SEARCH_DELAY = 6

# Bing Search base url, with new form= parameter (code differs per browser?)
URL = "https://www.bing.com/search?form=QBRE&q="
Expand Down Expand Up @@ -117,6 +118,12 @@ def parse_args():
help="The full path of the Chrome compatible browser executable",
type=check_path,
)
p.add_argument(
"-b",
"--bing",
help="Add this flag if your default search engine is Bing",
action="store_true"
)
# Mutually exclusive options. Only one can be present
group = p.add_mutually_exclusive_group()
group.add_argument(
Expand Down Expand Up @@ -303,8 +310,13 @@ def search(count, words_gen: Generator, agent, args, config):
# Get a random query from set of words
query = next(words_gen)

# Concatenate url with correct url escape characters
search_url = (config.get("search-url") or URL) + quote_plus(query)
# If the --bing flag is set, type the query to the address bar directly
if args.bing:
search_url = query
else:
# Concatenate url with correct url escape characters
search_url = (config.get("search-url") or URL) + quote_plus(query)

# Use pynput to trigger keyboard events and type search querys
if not args.dryrun:
# Alt + D to focus the address bar in most browsers
Expand Down

0 comments on commit 371c13c

Please sign in to comment.