This command-line tool clicks ads for a certain query on Google search using undetected_chromedriver package. Supports proxy, running multiple simultaneous browsers, ad targeting/exclusion, and running in loop.
-
Additional Features in Premium
- Single config file for all options
- Desktop UI for configuration and run
- Clear cache and cookies on browser exit
- External file for user agents
- Set browser window size
- Shift browser windows by random offsets
- Set opening URL based on the proxy country
- Set browser language based on the proxy country
- Random scrolls and mouse movements on pages
- Click non-ad links with domain filtering or in random
- Custom click order between ad and non-ad links
- Set min/max waiting range for ad and non-ad pages
- Limit max scroll on the search results page
- Use custom collected cookies
- Set the running interval time
- Summary of statistics
- Click on the top shopping ads up to 5
- 2captcha integration
- Telegram notification
- Generate daily click report
- Open found links on Android device
- Hooks for extending the tool with custom behavior
- Requires Python 3.9 to 3.11
- Requires the latest Chrome version
- Run the following commands in the project directory to install the required packages.
python -m venv env
source env/bin/activate
python -m pip install -r requirements.txt
- To be able to use
pyautogui
for random mouse movements,-
MacOS needs the
pyobjc-core
andpyobjc
modules installed (in that order) -
You must install tkinter on Linux.
sudo apt install python3-tk python3-dev
-
Windows does not have additional dependency.
-
See here for setup on Windows.
-
You need to see
(env)
at the beginning of your command prompt that is showing virtual environment is activated. -
Before running the below commands for the first time, run
python ad_clicker.py -q test
once and end it by pressing CTRL+C after seeing the browser opened. -
Run
python ad_clicker.py
for a single run with single browser. -
Run
python run_ad_clicker.py
for a single run with multiple browsers. -
Run
python run_in_loop.py
for running in loop with either single or multiple browsers. -
Run
python gui.py
for opening the following ui to configure/run. -
Run
python ad_clicker.py --report_clicks
for generating click report. -
Run
python ad_clicker.py --report_clicks --date
for generating click report for the given date in DD-MM-YYYY format. -
Run
python ad_clicker.py --report_clicks --excel
for generating click report and writing results to an Excel file.
All options can be set in the config.json
file in the project directory.
The followings are the default values in the config file.
{
"paths": {
"query_file": "/home/coskun/queries.txt",
"proxy_file": "/home/coskun/proxies.txt",
"user_agents": "user_agents.txt",
"filtered_domains": "domains.txt"
},
"webdriver": {
"proxy": "",
"auth": true,
"incognito": false,
"country_domain": false,
"language_from_proxy": false,
"ss_on_exception": false,
"window_size": "",
"shift_windows": false
},
"behavior": {
"query": "",
"ad_page_min_wait": 10,
"ad_page_max_wait": 15,
"nonad_page_min_wait": 15,
"nonad_page_max_wait": 20,
"max_scroll_limit": 0,
"check_shopping_ads": true,
"excludes": "",
"random_mouse": false,
"custom_cookies": false,
"click_order": 5,
"browser_count": 2,
"multiprocess_style": 1,
"loop_wait_time": 60,
"running_interval_start": "00:00",
"running_interval_end": "00:00",
"2captcha_apikey": "",
"hooks_enabled": false,
"telegram_enabled": false,
"send_to_android": false
}
}
-
query_file: File path to read queries to search. Used with
run_ad_clicker.py
andrun_in_loop.py
. Put a query for each line. -
proxy_file: File path to read proxies. Put a proxy for each line.
-
user_agents: File path to read user agents. Default value is
user_agents.txt
. -
filtered_domains: File path to read domains to filter for clicking non-ad links. Default value is
domains.txt
in the project directory. If you don't want to filter non-ad domains, simply leave thedomains.txt
file empty and 3 links will be randomly selected. -
proxy: Use the given proxy with
ad_clicker.py
. Theproxy_file
andproxy
parameters can not have a value at the same time. -
auth: Use proxy with username and password. If this is
true
, your proxies should be inusername:password@host:port
format -
incognito: Run in incognito mode. Note that the proxy extension is not enabled in
incognito
mode. -
country_domain: Set opening URL based on the proxy country.
-
language_from_proxy: Set browser locale language based on the proxy country.
-
ss_on_exception: Enable taking screenshot in case of an exception.
-
window_size: Set browser window size as
width,height
px. -
shift_windows: Shift browser windows by randomly selected x,y offsets.
- If you are using a display zoom other than 100%, use this together with
window_size
option. - If a custom
window_size
is given, it is used to determine a new widthxheight for the window. Otherwise, screen resolution is used.
- If you are using a display zoom other than 100%, use this together with
-
query: Search query. The
query_file
andquery
parameters can not have a value at the same time.-
A query like "wireless speaker@amazon#ebay # mediamarkt" searches for "wireless speaker" and click links that include the given filter words in url or title.
-
Spaces around "@" and "#" are ignored, so both "wireless speaker@amazon#ebay" and "wireless speaker @ amazon # ebay" take "wireless speaker" as search query and "amazon" and "ebay" as filter words.
-
If you will give a target domain as filter word, don't use "http" or "www" parts in it. Use like "[email protected]" or even "query@domainname". Keep it as short as possible to get a match.
-
-
ad_page_min_wait: Number of minimum seconds to wait on the ad page. The value is randomly selected between the min/max ranges.
-
ad_page_max_wait: Number of maximum seconds to wait on the ad page. The value is randomly selected between the min/max ranges.
-
nonad_page_min_wait: Number of minimum seconds to wait on the non-ad page. The value is randomly selected between the min/max ranges.
-
nonad_page_max_wait: Number of maximum seconds to wait on the non-ad page. The value is randomly selected between the min/max ranges.
-
max_scroll_limit: Number of maximum scrolls on the search results page. It will scroll until the end of the page by default(0).
-
check_shopping_ads: Enable checking and clicking shopping ads seen on top up to 5 if exists. It is more likely to see shopping ads if you use residential proxies.
-
excludes: Exclude the ads that contain given words in url or title.
- A value like "amazon.com,mediamarkt.com,for 2022,Soundbar" click links except the ones containing the given words in url or title.
- Separate multiple exclude items with comma.
-
random_mouse: Enable random mouse movements on pages.
-
custom_cookies: Use custom collected cookies. They should be put into
cookies.txt
file in the project directory. -
click_order: Click order for ad and non-ad links found
- 1: click all non-ad links first, then click ad links
- 2: click all ad links first, then non-ad links
- 3: click 1 non-ad, then 1 ad, then all remaining non-ads, finally all remaining ads
- 4: click 1 non-ad, then 1 ad on each round
- 5: shuffle ad and non-ad links and click whichever order is created (default)
-
browser_count: Maximum number of browsers to run concurrently. Used with
run_ad_clicker.py
andrun_in_loop.py
.- If the value is 0, the number of cpu cores is used.
-
multiprocess_style: Style of the multiprocess run. Used with
run_ad_clicker.py
andrun_in_loop.py
.-
1: different query on each browser (default)
- e.g. First, queries in the file are shuffled. Then, 5 browsers search the first 5 queries from the file.
-
2: same query on each browser
- e.g. 5 browsers search the first query from file. After they are completed, second group of 5 browsers search the second query and so on.
-
If the number of queries or proxies are less than the number of browsers to run, they are cycled.
-
If multiprocess_style is 1, queries read from the file are shuffled.
-
-
loop_wait_time: Wait time between runs in seconds. Default is 60. Used with
run_in_loop.py
. -
running_interval_start: Running interval start in "HH:MM" format. Used with
run_in_loop.py
.- If the current time is outside of the interval, it waits the start time to run again.
-
running_interval_end: Running interval end in "HH:MM" format. Used with
run_in_loop.py
.- Difference between start and end time must be at least 10 minutes.
- If both start and end is "00:00"(default), no interval check is done.
-
2captcha_apikey: API key for 2captcha service.
- Note that this is a 3rd party service, so you need to register with it to get an API key.
-
hooks_enabled: Enable hooks for extending the tool with custom behavior.
- You can implement the functions in the
hooks.py
module as your need. - Any errors coming from your custom implementation will be in your responsibility.
- Installing additional 3rd-party packages used in your implementation is in your responsibility.
- You can implement the functions in the
-
telegram_enabled: Enable Telegram notifications.
-
send_to_android: Send links to open on connected Android mobile device. Used with
run_ad_clicker.py
andrun_in_loop.py
.-
Note that mobile device must be connected to the same wireless network or directly via USB cable for one of these usages.
-
If you have less devices(n) than browsers you run, first n browsers will be assigned to n devices.
-
ADB setup steps
-
Open your phone’s Settings.
-
Scroll down to About phone.
-
Find Build number (usually under Software Information).
-
Tap Build number 7 times. You should see a message like "You are now a developer!"
-
Go back to Settings, and you will now see a Developer options menu.
-
Open Developer options and enable USB Debugging.
-
Install ADB on your computer
-
Verify installation
adb version
-
Connect your phone to your computer via USB.
- When prompted on your device, select Allow USB Debugging.
-
Check if ADB recognizes your device by running
adb devices
.- If you see your device’s ID, the connection is successful.
-
-
You can also use ADB wirelessly without a USB cable.
-
Connect your phone to your computer via USB and enable USB Debugging as explained before.
-
Run the following command.
adb tcpip 5555
-
Disconnect the USB cable and find the phone’s IP address (Settings > About phone > Status).
-
Connect ADB to your phone wirelessly.
adb connect <phone_ip>:5555
-
-
Watch an example run
-
Apply the following steps for once to enable Telegram notifications.
- Create your own Telegram bot using the BotFather.
- Set
TELEGRAM_TOKEN
environment variable with your own token received from the BotFather. You can see the instructions to set environment variables here for Linux, here for Windows, and here for Mac. - Run
python ad_clicker.py --enable_telegram
- Open https://t.me/<your_bot_name>
- Send
/start
command. - End script by pressing CTRL+C.
Watch recording of an execution
Which are the supported platforms?
You can run the tool on Linux(recommended) and Windows.Does it have a UI?
Yes, it has a desktop ui. This is a command-line tool but it just requires a simple command to start. All options can be set in a config file easily.What kind of proxies are supported?
It supports IPv4 http proxies.How many browsers can I run simultaneously?
It depends on your configuration and system properties. You can run as much as your number of cpu cores. I recommend (cpu core - 1) as maximum.How many clicks does it make per minute/hour?
It depends on your configuration.Can I send hundreds of clicks in a few minutes?
No, you can't. The goal of the tool is to become as close as possible to human behavior.What happens if there is captcha shown?
The tool has 2captcha integration. If you register for a 2captcha account, captcha is solved using it.What should I do if I need customization or support?
Please see the support section below.-
If you see this error, run the following commands.
-
Delete
.MULTI_BROWSERS_IN_USE
file if exists.rm .MULTI_BROWSERS_IN_USE
for Linux ordel .MULTI_BROWSERS_IN_USE
for Windows.
-
Run
python ad_clicker.py -q test
and end it by pressing CTRL+C after seeing the browser opened. -
Continue with one of the commands from How to run section.
-
-
If you get an error like "This version of ChromeDriver only supports Chrome version ... Current browser version is ...", it means you are using an older Chrome version and should update to the latest one.
-
You may need to apply solution from the previous section for some cases.
https://coskundeniz.github.io/ad_clicker
If you benefit from this tool, please give a star and consider donating using the sponsor links(patreon, ko-fi) or the following crypto addresses.
- ETH: 0x461c1B3bd9c3E2d949C56670C088465Bf3457F4B
- USDT: 0x1a4f06937100Dc704031386667D731Bea0670aaf