main
Khiem Ton 2 years ago
parent d86b314347
commit 1025ada7e8
Signed by: th4tkh13m
GPG Key ID: 4D9CF147DCADD05D

3
.gitignore vendored

@ -0,0 +1,3 @@
__pycache__
Pipfile
Pipfile.lock

@ -0,0 +1,77 @@
from math import pi, sin, cos, atan2, sqrt
class Location():
def __init__(self, latitude, longitude):
self.latitude = latitude
self.longitude = longitude
def distance(self, other):
R = 6371e3
d_lat = (self.latitude - other.latitude) * pi/180
d_lon = (self.longitude - other.longitude) * pi/180
a = sin(d_lat/2) * sin(d_lat/2) +\
sin(d_lon/2) * sin(d_lon/2) * cos(self.latitude) * cos(other.latitude)
c = 2 * atan2(sqrt(a), sqrt(1-a))
d = R * c / 1000
return d
def get_cooldown(self, other):
distance = self.distance(other)
if distance <= 2:
return 1
elif distance <= 5:
return 2
elif distance <= 7:
return 5
elif distance <= 10:
return 7
elif distance <= 12:
return 8
elif distance <= 18:
return 10
elif distance <= 26:
return 15
elif distance <= 42:
return 19
elif distance <= 65:
return 22
elif distance <= 81:
return 25
elif distance <= 100:
return 35
elif distance <= 220:
return 40
elif distance <= 250:
return 45
elif distance <= 350:
return 51
elif distance <= 375:
return 54
elif distance <= 460:
return 62
elif distance <= 500:
return 65
elif distance <= 565:
return 69
elif distance <= 700:
return 78
elif distance <= 800:
return 84
elif distance <= 900:
return 92
elif distance <= 1000:
return 99
elif distance <= 1100:
return 107
elif distance <= 1200:
return 114
elif distance <= 1300:
return 117
else:
return 120

@ -0,0 +1,28 @@
from datetime import datetime
class Pokemon():
def __init__(self, name, number, location,
cp, level, attack, defense, hp,
iv, shiny, start_time, end_time,
country):
self.name = name
self.number = number
self.location = location
self.cp = cp
self.level = level
self.attack = attack
self.defense = defense
self.hp = hp
self.iv = iv
self.shiny = shiny
self.start_time = start_time
self.end_time = end_time
self.country = country
def is_dispawned(self):
if datetime().now() > end_time:
return True
return False

@ -0,0 +1,3 @@
class Raid():
def __init__(self):
pass

@ -0,0 +1,35 @@
from bs4 import BeautifulSoup
import requests
def get_pokemons(url):
pokemon_lst = []
response = requests.get(url)
soup = BeautifulSoup(response.text, "lxml")
for row in scraper.find_all("tr")[1:]:
data = row.find_all("td")[1:]
name = data[0].text
number = int(data[1].text)
coordinates = map(float, data[2].text.split(","))
location = Location(*coordinates)
cp = int(data[3].text)
level = int(data[4].text)
attack = int(data[5].text)
defense = int(data[6].text)
hp = int(data[7].text)
iv = int(data[8].text.rstrip("%"))
shiny = data[9].text == "Yes"
start_time = datetime.fromisoformat(data[10].text)
end_time = datetime.fromisoformat(data[11].text)
country = data[12].text
pokemon = Pokemon(name, number, location, cp, level, attack, defense, hp, iv, shiny, start_time, end_time, country)
pokemon_lst.append(pokemon)

@ -0,0 +1,30 @@
from bs4 import BeautifulSoup
from ispoof.core.location import Location
from ispoof.core.pokemon import Pokemon
from datetime import datetime
import requests
pokemon_html = requests.get("https://moonani.com/PokeList/index.php")
scraper = BeautifulSoup(pokemon_html.text, "lxml")
for row in scraper.find_all("tr")[1:]:
data = row.find_all("td")[1:]
name = data[0].text
number = int(data[1].text)
coordinates = map(float, data[2].text.split(","))
location = Location(*coordinates)
cp = int(data[3].text)
level = int(data[4].text)
attack = int(data[5].text)
defense = int(data[6].text)
hp = int(data[7].text)
iv = int(data[8].text.rstrip("%"))
shiny = data[9].text == "Yes"
start_time = datetime.fromisoformat(data[10].text)
end_time = datetime.fromisoformat(data[11].text)
country = data[12].text
pokemon = Pokemon(name, number, location, cp, level, attack, defense, hp, iv, shiny, start_time, end_time, country)
print(pokemon)

@ -0,0 +1,4 @@
pymobiledevice3
beautifulsoup4
lxml
requests
Loading…
Cancel
Save