❓ Help Help give rice grains for the starving people

Status
Not open for further replies.

AlipioIV

Journeyman
Use it to bot some rice grains for the starving people. (y)
Script Python:

#!/usr/bin/env python
import time
import random
from selenium import webdriver
from argparse import ArgumentParser
def parse_args():
parser = ArgumentParser()
parser.add_argument('--headless', action='store_true', default=False, help="headless webdriver")
parser.add_argument('--user-agent', type=str, default="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36", help="User Agent")
parser.add_argument('--proxy', type=str, default=None, help="proxy")
return parser.parse_args()
def spawn_driver(user_agent, headless=True, proxy=None):
options = webdriver.firefox.options.Options()
options.headless = headless
profile = webdriver.FirefoxProfile()
profile.set_preference('general.useragent.override', user_agent)
profile.set_preference('dom.webnotifications.serviceworker.enable', False)
profile.set_preference('dom.webnotifications.enabled', False)
profile.set_preference('geo.enabled', False)
firefox_capabilities = webdriver.DesiredCapabilities.FIREFOX
if proxy:
firefox_capabilities['marionette'] = True
firefox_capabilities['proxy'] = {
"proxyType": "Manual",
"httpProxy": proxy,
"ftpProxy": proxy,
"sslProxy": proxy
}
driver = webdriver.Firefox(options=options, firefox_profile=profile, capabilities=firefox_capabilities)
driver.set_window_size(1280,1024)
return driver
def earn_points(driver, wait_time=5):
driver.get("You do not have permission to view the full content of this post. Log in or register now.")
driver.implicitly_wait(wait_time)
driver.find_element_by_xpath('/html/body/div[1]/div/div/div[2]/div[1]/button').click()
xpaths = ["/html/body/div[2]/section/div/div[1]/div/div/div[4]/div[1]/div/div/div/div/div/div[{}]".format(i) for i in range(2,5)]
while True:
try:
answer = random.choice(xpaths)
driver.find_element_by_xpath(answer).click()
driver.implicitly_wait(wait_time)
time.sleep(0.5)
points = driver.find_element_by_xpath("/html/body/div[2]/section/div/div[1]/div/div/div[4]/div[2]/div[2]/div[3]/span").text
reprint("Points: {}".format(points))
except ElementClickInterceptedException:
pass
def reprint(s):
print(s, end='')
print('\r' * len(s), end='')
if name == 'main':
args = parse_args()
driver = spawn_driver(args.user_agent, args.headless, args.proxy)
earn_points(driver)

How to use:
Save the script as a file
Download python (and add python to your path, it's an option on the installer)
open cmd.exe and type "pip install selenium argparse" (to install the dependencies)
open cmd.exe in the folder this script is in (hold shift and right click, then click on "open command prompt/powershell here")
type in "python script_name.py"
The bot will load freerice.com and randomly answer questions, each time it gets it right, 1-10 grains of rice go towards feeding hungry people
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 245
    Views
  • 2
    Participants
Last reply from:
AlipioIV

Trending Topics

Online now

Members online
1,068
Guests online
2,495
Total visitors
3,563

Forum statistics

Threads
2,295,042
Posts
29,095,028
Members
1,206,666
Latest member
leviheichou
Back
Top