I tried to automate the 100 yen deposit of Rakuten horse racing (python / selenium)

Purpose

** Easily raise the rank of Rakuten Happy Program **

table of contents

What is a happy program?

What is ** Happy Program **? Is it delicious? For those who say I will paste the reference image. image.png

Simply put, the higher the ** rank **, the more delicious you will feel.

There are various ways to raise this ** rank **. For example ...

  1. Deposit a lot of money in the bank.
  2. Receive salary from Rakuten Bank.
  3. Make a lot of transfers to other banks. etc ...

I honestly don't have a lot of money * (I want a bonus soon ...) * The salary is received at Mi * ho Bank * (not near Mi * ho's ATM ...) * I don't want to transfer money to other banks as much as possible. * (The fee is too high ...) *

I think there are many people who think the same way. rest assured.

There is a way to raise the rank that is perfect for you.

** Deposit only 100 yen to Rakuten Horse Racing every day. ** **

!!!!!??????

That's right, you only have to deposit 100 yen to Rakuten Horse Racing once a day.

If you continue it for 30 days, it will automatically become ** Super VIP **.

What's more, the 100 yen will be returned to you unharmed (unless you bet on your horse).

It's the best. But manually open the Rakuten Horse Racing app, type in your email address, It's quite annoying to type in the password and the PIN code.

In such a case, ** automation using python and selenium ** will be effective.

Prerequisites

  1. You have Google Chrome installed
  2. You have downloaded the Chrome Driver for your Google Chrome version. https://chromedriver.chromium.org/downloads (If you haven't downloaded yet, click here.)
  3. Have basic knowledge of Selenium and python

If you are new to python / Selenium, the following article is recommended https://qiita.com/memakura/items/20a02161fa7e18d8a693 https://qiita.com/mastar_3104/items/0a1ce2bfa1d29287bc35

python code

rakuten_automation.py


from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import chromedriver_binary
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('--headless')

driver = webdriver.Chrome("./chromedriver", options=options)
driver.get("https://keiba.rakuten.co.jp/?l-id=top_logo")

time.sleep(5)

if len(driver.find_elements_by_xpath("/html/body/section/div[2]/div")):
  pop = driver.find_element_by_xpath("/html/body/section/div[2]/div") 
  pop.click()
  send_money = driver.find_element_by_class_name("siteheader_actionlist_btn")
  send_money.click()
  driver.switch_to.window(driver.window_handles[1])
  driver.maximize_window()

  userid = driver.find_element_by_name("u")
  userid.send_keys("YourMailAddress")
  password = driver.find_element_by_name("p")
  password.send_keys("YourPassword")
  password.send_keys(Keys.RETURN)

  insert = driver.find_element_by_class_name("modal")
  insert.click()

  time.sleep(3)

  insert_money = driver.find_element_by_id("dialogDepositingInputPrice")
  insert_money.send_keys("amountOfMoney(ex.100)")
  confirm = driver.find_element_by_id("dialogDepositingConfirm")
  confirm.send_keys(Keys.RETURN)

  time.sleep(5)
  pincode = driver.find_element_by_id("dialogDepositingConfirmPin")
  pincode.send_keys("YourBankPINCode")
  complete_insert = driver.find_element_by_id("dialogDepositingComplete")
  complete_insert.send_keys(Keys.RETURN)
  
  time.sleep(3)

  driver.quit()

else:
  send_money = driver.find_element_by_class_name("siteheader_actionlist_btn")
  send_money.click()
  driver.switch_to.window(driver.window_handles[1])
  driver.maximize_window()

  userid = driver.find_element_by_name("u")
  userid.send_keys("YourMailAddress")
  password = driver.find_element_by_name("p")
  password.send_keys("YourPassword")
  password.send_keys(Keys.RETURN)

  insert = driver.find_element_by_class_name("modal")
  insert.click()

  time.sleep(3)

  insert_money = driver.find_element_by_id("dialogDepositingInputPrice")
  insert_money.send_keys("amountOfMoney(ex.100)")
  confirm = driver.find_element_by_id("dialogDepositingConfirm")
  confirm.send_keys(Keys.RETURN)

  time.sleep(5)
  pincode = driver.find_element_by_id("dialogDepositingConfirmPin")
  pincode.send_keys("YourBankPINCode")
  complete_insert = driver.find_element_by_id("dialogDepositingComplete")
  complete_insert.send_keys(Keys.RETURN)

  time.sleep(3)

  driver.quit()

If you move this, automatic deposit will be completed for the time being.

Attention ①

** "Your Mail Address" (your email address) "Your Password" "Your BANK PIN Code" (PIN) "Amount Of Money" **

rewrite.py


userid.send_keys("YourMailAddress")
password.send_keys("YourPassword")
pincode.send_keys("YourBankPINCode")
insert_money.send_keys("amountOfMoney(ex.100)")

Please enter appropriate values directly for the above four values.

I'm entering plain text in my email address, password, and PIN. I want to stop because it is a security problem carpenter ant. .. Please let us know in the comments if there is any good way.

Attention ②

The location of ChromeDriver should be in the same directory as the above python file.

Automation may suddenly stop working, but it's because ** out of ten ChromeDriver versions are out of date **. If it worked until yesterday and you suddenly get an error, first check if the Chrome version and Chrome Driver version match.

I will find the time and add the movement of each code.

Recommended Posts

I tried to automate the 100 yen deposit of Rakuten horse racing (python / selenium)
[Horse Racing] I tried to quantify the strength of racehorses
I tried to automate the article update of Livedoor blog with Python and selenium.
I tried to summarize the string operations of Python
I tried to find the entropy of the image with python
[Python] I tried to visualize the follow relationship of Twitter
I tried to get a database of horse racing using Pandas
I tried to automate the watering of the planter with Raspberry Pi
I tried to improve the efficiency of daily work with Python
(Python Selenium) I want to check the settings of the download destination of WebDriver
I tried to get the authentication code of Qiita API with Python.
(Python) I tried to analyze 1 million hands ~ I tried to estimate the number of AA ~
I tried to verify and analyze the acceleration of Python by Cython
I tried to streamline the standard role of new employees with Python
I tried to get the movie information of TMDb API with Python
I tried to touch the API of ebay
I tried to correct the keystone of the image
I tried to automate sushi making with python
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
[Python] I tried to judge the member image of the idol group using Keras
I tried to refactor the code of Python beginner (junior high school student)
I tried to automate the face hiding work of the coordination image for wear
I tried to automatically send the literature of the new coronavirus to LINE with Python
I tried to graph the packages installed in Python
I tried to summarize how to use matplotlib of python
I tried to summarize the basic form of GPLVM
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
[Python] I tried to graph the top 10 eyeshadow rankings
I tried to visualize the spacha information of VTuber
I tried to erase the negative part of Meros
I tried to solve the problem with Python Vol.1
[Python] I tried to get Json of squid ring 2
I tried to classify the voices of voice actors
I tried to put out the frequent word ranking of LINE talk with Python
Python practice 100 knocks I tried to visualize the decision tree of Chapter 5 using graphviz
I tried to visualize the running data of the racing game (Assetto Corsa) with Plotly
I tried to compare the processing speed with dplyr of R and pandas of Python
The 15th offline real-time I tried to solve the problem of how to write with python
I tried "gamma correction" of the image with Python + OpenCV
I tried to simulate how the infection spreads with Python
I tried to get the location information of Odakyu Bus
I tried the accuracy of three Stirling's approximations in python
I tried to find the average of the sequence with TensorFlow
Try to automate the operation of network devices with Python
I tried to implement the mail sending function in Python
[Machine learning] I tried to summarize the theory of Adaboost
I want to know the features of Python and pip
[Python] I tried collecting data using the API of wikipedia
I tried to enumerate the differences between java and python
I tried to fight the Local Minimum of Goldstein-Price Function
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I tried to divide the file into folders with Python
I tried to implement blackjack of card game in Python
How to write offline real time I tried to solve the problem of F02 with Python
I tried to create a Python script to get the value of a cell in Microsoft Excel
I wrote a doctest in "I tried to simulate the probability of a bingo game with Python"
I tried to automate the construction of a hands-on environment using IBM Cloud's SoftLayer API
I tried to touch Python (installation)
I tried to move the ball