{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Trying out Tyrone Mings TM scraper\n", "\n", "> Something has clearly changed with the transfermarkt website since this was published\n", "\n", "> Can probably just change players.py from here: https://github.com/FCrSTATS/tyrone_mings/tree/master/src\n", "\n", "> And tweak the transfer market value of the player code to make it work\n", "\n", "## TODO: Comeback to this." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import tyrone_mings as tm" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "club_urls = tm.get_club_urls_from_league_page(\"https://www.transfermarkt.com/premier-league/startseite/wettbewerb/GB1\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "west ham united players added\n", "wolverhampton wanderers players added\n", "leeds united players added\n", "fc chelsea players added\n", "manchester united players added\n", "leicester city players added\n", "aston villa players added\n", "west bromwich albion players added\n", "fc everton players added\n", "fc liverpool players added\n", "crystal palace players added\n", "brighton amp hove albion players added\n", "tottenham hotspur players added\n", "newcastle united players added\n", "fc southampton players added\n", "fc fulham players added\n", "manchester city players added\n", "sheffield united players added\n", "fc arsenal players added\n", "fc burnley players added\n" ] } ], "source": [ "player_urls = tm.get_player_urls_from_league_page(\"https://www.transfermarkt.com/premier-league/startseite/wettbewerb/GB1\", verbose = True)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "547" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(player_urls)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "for player_url in player_urls[:1]:\n", "\n", " output_dict = tm.tm_pull(player_url, market_value_history = True, performance_data = True, output = 'pandas')\n" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Empty DataFrame\n", "Columns: [club, value, data_date, age, player_id]\n", "Index: []\n" ] } ], "source": [ "print(output_dict['market_value_history'])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py37_football", "language": "python", "name": "py37_football" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.8" } }, "nbformat": 4, "nbformat_minor": 4 }