estiens / world_cup_json

Rails backend for a scraper that outputs World Cup data as JSON
927 stars 106 forks source link

Add team-lineup for every match. #116

Closed nSpider closed 5 years ago

nSpider commented 6 years ago

Hello guys, it's not an issue actually but, is it possible to add team-lineup for every match? If so, it will be great.

estiens commented 6 years ago

I'm actually working on something to pull in the starting 11 right now :)

nSpider commented 6 years ago

That's great. Waiting for the update...!!!

nSpider commented 6 years ago

Just a suggestion, can you scrape from third party websites other than FIFA? like goal.com, etc.

estiens commented 6 years ago

we could yes, if someone wanted to write a scraper for them, would be nice to verify or be able to switch between them

simofacc commented 6 years ago

@estiens the only problem I see with multiple scrapers is that the data reported on the fifa.com site is going to be different on other sites as they might use different data feeds, especially if we cannot map the fifa match id.

estiens commented 6 years ago

yeah you would have to either switch entirely and us a different unique ID or match on FIFA site by datetime and teams

estiens commented 6 years ago

Starting 11 and subs are part of all past matches now and should come in when a match starts. Players show up with position, captain status, jersey number, and name

simofacc commented 6 years ago

@estiens Which task should get the starting_eleven? I ran most of them and also tried fifa:get_events but it didn't pull the lineups for the old matches.

estiens commented 6 years ago

The new JSON task will...it will run with the clock but first you have to run

Scrapers::ScraperTasks.setup_matches_for_json

You can pull in historic data with write_old_match_json

simofacc commented 6 years ago

@estiens When I run Scrapers::ScraperTasks.write_old_match_json I get an empty array

estiens commented 6 years ago

Did you run Scrapers::ScraperTasks.setup_matches_for_json first? that sets all the unique IDs that we need to generate the match URLs for pulling in specifics

simofacc commented 6 years ago

@estiens yes I did do that

simofacc commented 6 years ago

What is the unique Id name I should look for? I got something like the below as an output

=> [#<Match id: 5, fifa_id: "300331533", location: "Kazan Arena", datetime: "2018-06-16 22:00:00", home_team_id: 9, away_team_id: 10, home_team_tbd: nil, away_team_tbd: nil, teams_scheduled: nil, home_team_score: 2, away_team_score: 1, status: "end of time", created_at: "2018-06-22 22:41:09", updated_at: "2018-06-26 13:13:06", home_team_penalties: nil, away_team_penalties: nil, venue: "Kazan", time: "full-time", last_score_update_at: "2018-06-22 23:09:53", last_event_update_at: "2018-06-22 23:09:53", stats_complete: true, winner_id: 9, draw: false, events_complete: true, fifa_competition_id: "17", fifa_season_id: "254645", fifa_group_id: "275079", fifa_stage_id: "275073", stage_name: "First stage", weather: nil, attendance: nil, json_home_team_score: nil, json_away_team_score: nil, json_home_team_penalties: nil, json_away_team_penalties: nil, officials: nil>, #<Match id: 8, fifa_id: "300331523", location: "Kaliningrad Stadium", datetime: "2018-06-16 19:00:00", home_team_id: 15, away_team_id: 16, home_team_tbd: nil, away_team_tbd: nil, teams_scheduled: nil, home_team_score: 2, away_team_score: 0, status: "end of time", created_at: "2018-06-22 22:41:09", updated_at: "2018-06-26 13:13:06", home_team_penalties: nil, away_team_penalties: nil, venue: "Kaliningrad", time: "full-time", last_score_update_at: "2018-06-22 23:10:23", last_event_update_at: "2018-06-22 23:10:24", stats_complete: true, winner_id: 15, draw: false, events_complete: true, fifa_competition_id: "17", fifa_season_id: "254645", fifa_group_id: "275081", fifa_stage_id: "275073", stage_name: "First stage", weather: nil, attendance: nil, json_home_team_score: nil, json_away_team_score: nil, json_home_team_penalties: nil, json_away_team_penalties: nil, officials: nil>, #<Match id: 13, fifa_id: "300331539", location: "Fisht Stadium", datetime: "2018-06-18 15:00:00", home_team_id: 25, away_team_id: 26, home_team_tbd: nil, away_team_tbd: nil, teams_scheduled: nil, home_team_score: 3, away_team_score: 0, status: "end of time", created_at: "2018-06-22 22:41:10", updated_at: "2018-06-26 13:13:06", home_team_penalties: nil, away_team_penalties: nil, venue: "Sochi", time: "full-time", last_score_update_at: "2018-06-22 23:12:03", last_event_update_at: "2018-06-22 23:12:05", stats_complete: true, winner_id: 25, draw: false, events_complete: true, fifa_competition_id: "17", fifa_season_id: "254645", fifa_group_id: "275087", fifa_stage_id: "275073", stage_name: "First stage", weather: nil, attendance: nil, json_home_team_score: nil, json_away_team_score: nil, json_home_team_penalties: nil

simofacc commented 6 years ago

@estiens Ok I think I found the issue. Somehow my matches status in the database are saved as end of time but the query is looking for a status of completed so it's not finding any matches.

estiens commented 6 years ago

ah yes, sorry about that, so many changes every day it's hard for me to keep track of set up for a new database -- you can run scrape_for_events and scrape_for_stats and it will grab those and then mark it completed once it is sure the game is over and it has all the events.