Skip to content

the-guitarman/ex_fussball_de_scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Code Climate Built with Spacemacs

ExFussballDeScraper

This application grabs next matches and the current table from a fussball.de team website.

Installation

If available in Hex, the package can be installed as dependency ex_fussball_de_scraper in mix.exs:

def deps do
  [
    {:ex_fussball_de_scraper, "~> 0.1"}
  ]
end

Configuration

The app has default configurations:

config :ex_fussball_de_scraper, :css,
  team_name: ".stage-team h2",
  matches: "#id-team-matchplan-table tbody tr",
  matches_match_id: "td:last-child a",
  matches_match_headline: "td:first-child",
  matches_match_headline_splitter: "|",
  matches_match_club_names: "td.column-club .club-name",
  current_table: "#team-fixture-league-tables > table",
  season_split_at: "/",
  season_join_with: "-"

config :ex_fussball_de_scraper, :url,
  scheme: "https",
  host: "www.fussball.de",
  path_regex: ~r/\/mannschaft\/(?<team_rewrite>[^\/]+)\/-\/saison\/(?<saison>\d\d\d\d)\/team-id\/(?<team_id>[^\/]+)(#!(?<fragment>[^\/]+))*/
  
config :ex_fussball_de_scraper, :gen_server,
  call_timeout: 2000

You may overwrite it by setting some of these configurations in your project.

Usage

To use this app you need a rewrite and an id for your team from fussball.de. Therefore go to the team website at fussball.de and have a look to the url. The format is like: http://www.fussball.de/mannschaft//-/saison//team-id/#!/section/stage Copy the values within <> and use it like so:

Receive the next matches:

ExFussballDeScraper.Scraper.next_matches("club-name-team-rewrite", "team-id")

This returns a tuple:

{:ok, %{team_name: "my team name", matches: [...]}, timestamp}
{:error, error_reason, timestamp}

Receive the current table

ExFussballDeScraper.Scraper.current_table("club-name-team-rewrite", "team-id")

This returns a tuple:

{:ok, %{team_name: "my team name", current_table: html_string}, timestamp}
{:error, error_reason, timestamp}

License

Everything may break everytime. Therefore this package is licensed under the LGPL 3.0. Do whatever you want with it, but please give improvements and bugfixes back so everyone can benefit.

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_fussball_de_scraper.

About

Provides information from a team website at fussball.de.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published