Skip to content

Commit

Permalink
Merge pull request #4 from mrgretwon/enter_credentials_manually
Browse files Browse the repository at this point in the history
Enter credentials manually
  • Loading branch information
mrgretwon authored Oct 16, 2020
2 parents 2da9ee2 + 882799a commit 4effe6d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 22 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

Bot uses selenium framework to run fut web app. This is the best way to not get banned, because it is very similar to a normal user activity.

First step is logging in. Bot have access to your email inbox, so it can read the newest ea message with an access code.
First step is logging in. You can do it manually or automatically.
If automatically - Bot have access to your email inbox, so it can read the newest ea message with an access code.
After running the web app, your filters are used to find a player (name and max price).

The min price is increased before every search to have the results refreshed every time.
Expand All @@ -31,6 +32,25 @@ pip install -r requirements.txt
## Configuration

Everything is configured using `config.py` file.

Enter the name of the player name and the maximum number of coins you want to spend for him.
Example:

```
PLAYER = {
"name": "Sterling",
"cost": 100000,
}
```

### Automatic login

If you want to automatically login to web app, change this variable to False:

```
LOGIN_MANUALLY = False
```

Provide your credentials:

```
Expand All @@ -50,16 +70,6 @@ EMAIL_CREDENTIALS = {
}
```

Enter the name of the player name and the maximum number of coins you want to spend for him.
Example:

```
PLAYER = {
"name": "Sterling",
"cost": 100000,
}
```

## Running

**Linux/Mac systems**
Expand Down
25 changes: 23 additions & 2 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@ def __init__(self):
self.driver.get(URL)
print("Starting sniping bot...")

def login(self, user):
def go_to_login_page(self):
WebDriverWait(self.driver, 15).until(
EC.visibility_of_element_located((By.XPATH, '//*[@class="ut-login-content"]//button'))
)
print("Logging in...")
sleep(2)
self.driver.find_element(By.XPATH, '//*[@class="ut-login-content"]//button').click()

WebDriverWait(self.driver, 10).until(
EC.visibility_of_element_located((By.ID, 'email'))
)

print("Logging in...")
def login(self, user):
self.go_to_login_page()

self.driver.find_element(By.ID, 'email').send_keys(user["email"])
self.driver.find_element(By.ID, 'password').send_keys(user["password"])
self.driver.find_element(By.ID, 'btnLogin').click()
Expand All @@ -49,6 +52,24 @@ def login(self, user):
)
sleep(2)

def login_manually(self):
self.go_to_login_page()

print("Enter your account credentials and click login button.")
print("Waiting 5 minutes...")

WebDriverWait(self.driver, 300).until(
EC.element_to_be_clickable((By.ID, 'btnSendCode'))
).click()

print("Provide EA access code and click submit button.")
print("Waiting 5 minutes...")

WebDriverWait(self.driver, 300).until(
EC.visibility_of_element_located((By.CLASS_NAME, 'icon-transfer'))
)
sleep(2)

def go_to_transfer_market(self):
self.driver.find_element(By.CLASS_NAME, 'icon-transfer').click()

Expand Down
20 changes: 13 additions & 7 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,27 @@ def create_driver():

URL = "https://www.ea.com/pl-pl/fifa/ultimate-team/web-app/"

USER = {
"email": "[email protected]",
"password": "your_password",
}
EA_EMAIL = "[email protected]"

PLAYER = {
"name": "Kloster",
"cost": 20000,
"cost": 15000,
}

INCREASE_COUNT = 20

LOGIN_MANUALLY = True

# Credentials - fill if LOGIN_MANUALLY is False

USER = {
"email": "[email protected]",
"password": "your_password",
}

EMAIL_CREDENTIALS = {
"email": "[email protected]",
"password": "your_password",
}

EA_EMAIL = "[email protected]"

INCREASE_COUNT = 20
8 changes: 6 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from src.bot import Bot
from src.config import USER, PLAYER
from src.config import USER, PLAYER, LOGIN_MANUALLY

bot = Bot()
bot.login(USER)
if LOGIN_MANUALLY:
bot.login_manually()
else:
bot.login(USER)

bot.buy_player(PLAYER["name"], PLAYER["cost"])


0 comments on commit 4effe6d

Please sign in to comment.