Exemplo n.º 1
0
async def command_ygg(app: GraiaMiraiApplication, group: Group,
                      _gm: GroupMessage):
    CP = CommandParser(_gm, settings.commandSymbol)
    _playerName = CP.Command.args if CP.Command.args else CP.quote_plain_message
    _player = PlayerProfile(_playerName)
    _message = _player.getYgg()
    await app.sendGroupMessage(group, MessageChain.create(_message))
Exemplo n.º 2
0
    def __init__(self, url, name, scrapper):
        self.LeagueName = name
        soup = scrapper(url)

        #reading player table and filtering for offensive players
        playerTable = soup.find("table", class_="items")

        players = playerTable.find_all("a", class_="spielprofil_tooltip")[::2]
        offensivePlayers = filter(Team.isStrikerOrWinger, players)
        offensivePlayersUrls = [
            BASE_URL + player["href"] for player in offensivePlayers
        ]
        print("\n Now Offensive players list \n")
        print(offensivePlayersUrls)
        print("\n")

        #Team URL: https://www.transfermarkt.co.uk/ajax-amsterdam/startseite/verein/610/saison_id/2017

        URLname = re.search('(.*uk\/)(.*)(\/start.*)', url)
        TeamName = (URLname.group(2))

        print("Team " + str(TeamName) + " From '" + str(url) + "'")

        #self.PlayerData = [PlayerProfile( playerUrl, scrapper) for playerUrl in offensivePlayersUrls]
        self.PlayersData = []
        for playerUrl in offensivePlayersUrls:
            try:
                NewPlayerProfile = PlayerProfile(playerUrl, scrapper)
                NewPlayerProfile.PlayerData["current league"] = self.LeagueName
                self.PlayersData.append(NewPlayerProfile)
            except:
                continue
Exemplo n.º 3
0
async def command_ygg(app: GraiaMiraiApplication, group: Group,
                      _gm: GroupMessage):
    M = MessagePro(_gm)
    _playerName = M.Command.args if M.Command.args else M.quote_plain_message
    _player = PlayerProfile(_playerName)
    _message = _player.getYgg()
    await app.sendGroupMessage(group, MessageChain.create(_message))
	def __init__( self, url, name, scraper):
		self.LeagueName = name
		soup = scraper(url)
		#reading player table and filtering for offensive players
		playerTable = soup.find("table", class_="items")
		players = playerTable.find_all("a", class_="spielprofil_tooltip")[::2]
		#offensivePlayers = filter( Team.isStrikerOrWinger, players)
		PlayersUrls = [BASE_URL + player["href"] for player in players]
		self.PlayerData = [PlayerProfile( playerUrl, scraper) for playerUrl in PlayersUrls]
		self.PlayersData = []
		for playerUrl in PlayersUrls:
			try:
				NewPlayerProfile = PlayerProfile( playerUrl, scraper)
				NewPlayerProfile.PlayerData["current league"] = self.LeagueName
				self.PlayersData.append( NewPlayerProfile)
			except:
				continue
Exemplo n.º 5
0
def serveSuccess(name):
    for link in duckduckgo.search(name, 10):
        url = link
        break
    player = PlayerProfile(url, bs)

    data = {}
    data['query'] = name
    data['duck_source'] = url
    data['tranfermarkt_image_figurina'] = player.PlayerData.img

    json_data = json.dumps(data)
    return json_data
Exemplo n.º 6
0
    def __init__(self, url, name, scraper, teamName):
        self.LeagueName = name
        self.TeamName = teamName
        soup = scraper(url)
        # reading player table and filtering out goalkeepers
        playerTable = soup.find("table", class_="items")
        players = playerTable.find_all("a", class_="spielprofil_tooltip")[::2]
        players = filter(Team.isNotGoalkeeper, players)
        playersUrls = [BASE_URL + player["href"] for player in players]
        #self.PlayerData = [PlayerProfile( playerUrl, scraper) for playerUrl in playersUrls]
        self.PlayersData = []
        bar = ChargingBar("Extracting " + self.TeamName + " players",
                          max=len(playersUrls))
        for playerUrl in playersUrls:
            # print("playerUrl", playerUrl)
            try:
                NewPlayerProfile = PlayerProfile(playerUrl, scraper)
                NewPlayerProfile.PlayerData["current league"] = self.LeagueName
                self.PlayersData.append(NewPlayerProfile)
                bar.next()
            except:
                continue

        bar.finish()