Home | Zones | Log in | Register

2020 Week 3 General Thread

football injuries incompatible with life nfl week 3

Nobody | Reply | Create New Thread New Thread
Page 1 of /1

Let’s argue about NFL Week 3 2020-2021 here!

Week 3

Away Home Day/Time Broadcaster Result
Jacksonville Miami Thursday, Sept. 24 @ 8:20 PM ET NFLN Miami, 31-13
Atlanta Chicago Sunday, Sept. 27 @ 1 PM ET FOX Chicago, 30-26
Buffalo Los Angeles Rams Sunday, Sept. 27 @ 1 PM ET FOX Buffalo, 35-22
Cleveland Washington Sunday, Sept. 27 @ 1 PM ET FOX Cleveland, 34-20
Minnesota Tennessee Sunday, Sept. 27 @ 1 PM ET CBS Tennessee 31-30
New England Las Vegas Sunday, Sept. 27 @ 1 PM ET CBS New England, 36-20
New York Giants San Francisco Sunday, Sept. 27 @ 1 PM ET FOX San Francisco, 36-9
Philadelphia Cincinnati Sunday, Sept. 27 @ 1 PM ET CBS Tie, 23-23
Pittsburgh Houston Sunday, Sept. 27 @ 1 PM ET CBS Pittsburgh, 28-21
Indianapolis New York Jets Sunday, Sept. 27 @ 4:05 PM ET CBS Indianapolis, 36-7
Los Angeles Chargers Carolina Sunday, Sept. 27 @ 4:05 PM ET CBS Carolina, 21-16
Arizona Detroit Sunday, Sept. 27 @ 4:25 PM ET FOX Detroit, 26-23
Denver Tampa Bay Sunday, Sept. 27 @ 4:25 PM ET FOX Tampa Bay, 28-10
Seattle Dallas Sunday, Sept. 27 @ 4:25 PM ET FOX Seattle, 38-31
New Orleans Green Bay Sunday, Sept. 27 @ 8:20 PM ET NBC Green Bay, 37-30
Baltimore Kansas City Monday, Sept. 28 @ 8:15 PM ET ESPN Kansas City, 34-20

Please no stream links here - Tiko shouldn’t have to deal with NFL DMCA notices

Edited by MasterOfMagic at 2020-10-02 01:29:172020-10-02 01:29
Trying too hard
| Posted: 2020-09-24 20:02:572020-09-24 20:02 | Filter

MasterOfMagic changed the thread title from 2020 Week 2 General Thread to 2020 Week 3 General Thread.

DMCAs nuts

From: Mister Taxi at 2020-09-24 20:10:13
DMCAs nuts

Pretty good

Trying too hard

I spent more time than I’d like to admit today writing code to generate that game table instead of copying and pasting it. Good news is that the rest of the weeks will be a cakewalk.

Edited by MasterOfMagic at 2020-09-27 02:09:372020-09-27 02:09
Trying too hard

Shit Perl code alert - the spoiler block is fucking it up on my screen, so if for some reason you want to copy this code let me know and I’ll unspoiler it.

<learning Mojo::UserAgent, removed unused modules, passed through perltidy>
#!/usr/bin/env perl
use Getopt::Long;
use Mojo::UserAgent;

use strict;
use warnings;

use constant SCRAPE_URL =>
  'https://www.sportingnews.com/us/nfl/news/nfl-schedule-2020-dates-times-channels-week-by-week/112tca2d0jcy91t47yhzemrrhp';

my %TEAM_MAP = (
    'Jacksonville Jaguars' => 'Jacksonville',
    'Miami Dolphins'       => 'Miami',
    'Atlanta Falcons'      => 'Atlanta',
    'Chicago Bears'        => 'Chicago',
    'Buffalo Bills'        => 'Buffalo',
    'Los Angeles Rams'     => 'Los Angeles Rams',
    'Cleveland Browns'     => 'Cleveland',
    'Washington Redskins'  => 'Washington',
    'Minnesota Vikings'    => 'Minnesota',
    'Tennessee Titans'     => 'Tennessee',
    'New England Patriots' => 'New England',
    'Las Vegas Raiders'    => 'Las Vegas',
    'New York Giants'      => 'New York Giants',
    'San Francisco 49ers'  => 'San Francisco',
    'Philadelphia Eagles'  => 'Philadelphia',
    'Cincinnati Bengals'   => 'Cincinnati',
    'Pittsburgh Steelers'  => 'Pittsburgh',
    'Houston Texans'       => 'Houston',
    'Indianapolis Colts'   => 'Indianapolis',
    'New York Jets'        => 'New York Jets',
    'Los Angeles Chargers' => 'Los Angeles Chargers',
    'Carolina Panthers'    => 'Carolina',
    'Arizona Cardinals'    => 'Arizona',
    'Detroit Lions'        => 'Detroit',
    'Denver Broncos'       => 'Denver',
    'Tampa Bay Buccaneers' => 'Tampa Bay',
    'Seattle Seahawks'     => 'Seattle',
    'Dallas Cowboys'       => 'Dallas',
    'New Orleans Saints'   => 'New Orleans',
    'Green Bay Packers'    => 'Green Bay',
    'Baltimore Ravens'     => 'Baltimore',
    'Kansas City Chiefs'   => 'Kansas City',
);

my %TV_MAP = ('NFLN' => 'NFL Network',);

sub handle_week($$) {
    my ($sched_hashref, $e) = @_;
    die "Invalid week header" unless $e->all_text =~ /^Week (\d+)$/;
    $sched_hashref->{$1} = [];
    return $1;
}

sub handle_gameday($$$) {
    my ($sched_hashref, $current_week, $e) = @_;
    return $e->all_text();
}

sub handle_gametable($$$$) {
    my ($sched_hashref, $current_week, $current_gameday, $e) = @_;
    foreach my $kid ($e->children('table > tbody')->each) {
        foreach my $babby ($kid->children('tr')->each) {
            my ($teams, $time, $network) =
              map {$_->all_text} ($babby->children('td')->each);
            next if $teams =~ /^Game$/;
            my ($home, $away) = split(/\sat\s/, $teams);
            push @{ $sched_hashref->{$current_week} },
              {
                'gameday' => $current_gameday,
                'home'    => $home,
                'away'    => $away,
                'time'    => $time,
                'network' => $network
              };
        }
    }
}

sub scrape_page($) {
    my ($tgt_url) = @_;

    my $ua       = Mojo::UserAgent->new;
    my $res      = $ua->get(SCRAPE_URL)->result;
    my $gamedata = $res->dom->find(
        'body > main.main-content > section.grid > article.article > div > section.article-body ~ h2,h3.block-element__h3,ul.block-element__ul,table'
    );

    my $sched_hashref   = {};
    my $current_week    = -1;
    my $current_gameday = undef;

    foreach my $e ($gamedata->each) {
        if ($e->matches('h3')) {
            $current_week = handle_week($sched_hashref, $e);
        }
        elsif ($e->matches('ul')) {
            $current_gameday =
              handle_gameday($sched_hashref, $current_week, $e);
        }
        elsif ($e->matches('table')) {
            handle_gametable($sched_hashref, $current_week,
                $current_gameday, $e);
        }
        else {
            die "SHIT";
        }
    }

    return $sched_hashref;
}

sub print_schedule($$) {
    my ($sched_hashref, $week) = @_;
    die unless $sched_hashref->{$week};
    print "### Week $week\n";
    print join('|',
        '',            'Away',   'Home', 'Day/Time',
        'Broadcaster', 'Result', "\n");
    print join('|',
        '',            '----',   '----', '--------',
        '-----------', '------', "\n");
    foreach my $game (@{ $sched_hashref->{$week} }) {
        $game->{'time'} =~ s/p\.m\./PM/;
        print join('|',
            '',
            $TEAM_MAP{ $game->{'away'} } // '',
            $TEAM_MAP{ $game->{'home'} } // '',
            join(' @ ', $game->{'gameday'}, $game->{'time'}),
            $TEAM_MAP{ $game->{'network'} } // $game->{'network'},
            '',
            "\n");
    }
}

sub main() {
    my $week = 3;
    GetOptions("week=i", \$week)
      or die "Error in command line arguments";

    my $sched_hashref = scrape_page(SCRAPE_URL);
    print_schedule($sched_hashref, $week);
}

main();

I can probably consolidate some of those CSS selectors, but that requires thinking and it’s the weekend…

</learning Mojo::UserAgent, removed unused modules, passed through perltidy>
<bonus hacky Python>
import argparse
import bs4
import re
import requests

SCRAPE_URL = 'https://www.sportingnews.com/us/nfl/news/nfl-schedule-2020-dates-times-channels-week-by-week/112tca2d0jcy91t47yhzemrrhp'
TEAM_REWRITE = {'Los Angeles Rams', 'New York Giants', 'New York Jets',
                'Los Angeles Chargers'}
NETWORK_REWRITE = {'NFLN': 'NFL Network'}


def handle_week(element, week_dict):
    m = re.match(r'^Week (\d+)$', element.string)
    if not m:
        print("FUCK")
        exit(1)

    week_dict[m.group(1)] = []
    return m.group(1)


def trim_team_name(team):
    if team not in TEAM_REWRITE:
        parts = team.split(" ")
        team = " ".join(parts[0:-1])

    return team


def handle_gametable(element, cur_week, cur_gameday, week_dict):
    cells = element.select('table > tbody tr > td')

    # Make sure we have a multiple of three cells
    if (len(cells) % 3 != 0):
        print("FUCK")
        exit(1)

    while(cells):
        teams, time, network = cells[0:3]
        if not re.match(r"^Game$", teams.string):
            home_team, away_team = map(trim_team_name,
                                       teams.string.split(' at '))

            network = network.string
            if network in NETWORK_REWRITE:
                network = NETWORK_REWRITE[network]

            p = re.compile(r'p\.m\.')
            time = ' @ '.join([cur_gameday, p.sub('PM', time.string)])

            gamedata = {'home': home_team,
                        'away': away_team,
                        'time': time,
                        'network': network}

            week_dict[cur_week].append(gamedata)
        cells = cells[3:]


def scrape_page(url):
    week_dict = {}

    r = requests.get(url)

    if not r.ok:
        print("FUCK")
        exit(1)

    soup = bs4.BeautifulSoup(r.text, 'html.parser')
    elements = soup.select('body > main.main-content > section.grid > article.article > div > section.article-body ~ h2,h3.block-element__h3,ul.block-element__ul,table')

    cur_week, cur_gameday = -1, None

    for element in elements:
        if (element.name == "h3"):
            cur_week = handle_week(element, week_dict)

        elif (element.name == "ul"):
            cur_gameday = element.text

        elif (element.name == "table"):
            handle_gametable(element, cur_week, cur_gameday, week_dict)

        else:
            print("FUCK")
            exit(1)

    return week_dict


def print_tz_markdown(week, gamedata):
    week = str(week)
    if week not in gamedata:
        print("FUCK")
        exit(1)

    print(f'### Week {week}')
    print('|'.join(['', 'Away', 'Home', 'Day/Time', 'Broadcaster', 'Result',
                    '']))
    print('|'.join(['', '----', '----', '--------', '-----------', '------',
                    '']))

    games = gamedata[week]
    for game in games:
        print('|'.join(['', game['away'], game['home'], game['time'],
                        game['network'], '', '']))


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Dump games for NFL threads')
    parser.add_argument('--week', type=int, default=3,
                        help="Week to scrape data for")
    args = parser.parse_args()

    gamedata = scrape_page(SCRAPE_URL)
    print_tz_markdown(args.week, gamedata)
</bonus hacky Python>
Edited by MasterOfMagic at 2020-09-27 07:52:032020-09-27 07:52
Trying too hard

Perl? I didn’t realize you were 50 years old

Is it worse that I have over a decade of professional experience with Perl?

Trying too hard

Why can I stream legally from a phone app but there’s no free stream on laptop/desktop

Because licensing agreements

Trying too hard

oh well I found an “alternative”

what’s this? touchdown pass? might as well try it lol

I hope this waitress comes to my field goal party.

Trying too hard

wtf Philly?

Edited by MasterOfMagic at 2020-09-27 20:48:402020-09-27 20:48
Trying too hard

wtf Cincinnati playing for a tie

Trying too hard

Fuck the refs

Iced us out wasting like 5 minutes on a dumpass review of a spot

Blasty just called me, crying

Trying too hard

XFD he missed it

Trying too hard

Fumbled out of the back of the end zone, what a fucking idiot

Trying too hard

GO PACK GO

Trying too hard

gdi Packers D

Trying too hard

Giving up 3rd and 15 is a good thing, right?

Trying too hard

What’s it like to have a defense?

Trying too hard

FOR FUCK SAKE CAN YOU MAKE A FIRST TIME TACKLE FOR ONCE?

Trying too hard

And here’s where the Packers lost the game.

Trying too hard

Welp

Trying too hard
Reply:
To reply to this thread, please join this community.
Pages: 1
1 person is reading this thread now.
Thread List | ↑ Top