You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
999 B

2 years ago
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)