Skip to Content
Interviews

An Interview With The Creators Of A Bot That Spits Out A Random NBA Play Every Three Hours

10:54 AM EST on December 2, 2020

Derrick Favors of the Utah Jazz grabs a rebound as Damian Lillard, Meyers Leonard, and C.J. McCollum of the Portland Trail Blazers look on
Photo: Chris Gardner/Getty Images

What twist of fate could have led you to the above image of Derrick Favors grabbing a rebound as Damian Lillard, Meyers Leonard, and C.J. McCollum look on? The answer: a Getty Images query for "nba 2018 december" and a randomly chosen page within those results. That's more or less what the Random NBA Plays bot does, except it adds the dimension of time.

The Twitter account serves up random eight-second clips onto Twitter, functioning as a balm for fans during the suspended season; now, with the NBA back, it provides a lighter alternative to YouTube degeneracy. I spoke with Gideon Rosenthal and Louis Keene, who created the bot, to talk about why they made it, what it does for them as basketball fans, and what went wrong with the art of the basketball highlight. This interview has been lightly edited and condensed for clarity.

What was the impetus for this project?

Gideon Rosenthal: It starts with an even dumber idea. You may have heard this joke before: What's the best time to go to the dentist? Tooth-hurty.

Yes. Classic.

GR: I'm a software engineer, and I have a pretty normal, kind of boring day job. I'm always looking for dumb things to code. So I was like, I'm just gonna build a Twitter bot that tweets out every day at 2:30 that it's time to go to the dentist. It didn't really get any traction, and honestly, I think really annoyed a lot of people. I had multiple people message me, good friends, being like, "Gideon, I can't do this anymore. I need to unfollow it."

Louis Keene: We had the Ersan bot, where we were trying to figure out a way to tweet every time [former Bucks power forward] Ersan Ilyasova drew a charge. It was hard—we couldn't get the NBA video box score to return the video of him drawing the charge immediately. There were a bunch of issues with building that bot to do what we wanted it to do.

GR: Yeah, Louis approached me with that idea and I spent a lot of time looking at what's available online. We were trying to do it in real time, and there are ways to do it, but it's just the tech, like Louis said. I don't know if you've ever been on stats.nba.com, but they do upload the full play-by-play videos, but only an hour after the game ended. So it was working, and we're uploading the Ersan charges basically an hour after the games, but there were a couple problems. One, Ersan just wasn't getting that much playing time, and as a result wasn't getting that many charges. It just was never tweeting. Then the season ended. Louis texted me again, "Why don't we just do random NBA games?" I was like, "Yeah, that sounds perfect." I can definitely go more into detail in terms of—I had to go through some pretty ridiculous lengths to get it to work. This started with the Ersan bot, and that laid the foundation, but the idea is that you want to have these scripts running on a computer that's on all the time. I can't do it on my laptop, because then my laptop would have to be open all the time. So then I put it up on Amazon Web Services. But the problem with that is it's pretty easy for NBA.com—and also, tell me if this is way too much.

No, honestly, mundane esoterica is my beat. So yeah, keep it going.

GR: OK, so when you're in IT, it's pretty easy for engineers to be like, "OK, we're gonna restrict any IP address that's coming from another Amazon server," because you can basically guarantee that those are never real users, right? Only people who are running scripts. It was working on my computer, but I couldn't get it to work on Amazon. I was getting so annoyed. Finally, I came up with the idea to use a Tor router. The way it works is that it sends your requests through other people on the network. It basically obfuscates where your IP address is. I was doing that on Amazon, so that was working for a while. Which is just ridiculous, because the only other people who use it are, I don't know, people looking at child pornography and political dissidents in Iran. And then me. That was working for a while, but I think they must have changed something, because eventually it stopped. I think they found a way to block that.

Who's the "they" doing the blocking in that case?

GR: "Reverse engineering" makes it sound a lot more sophisticated than it is. But if you go to stats.nba.com, you go to play-by-play, and then if you go into web inspector, you can see what requests it's making. Then you simulate that to get what you're looking for, and you have to include more fields. It's kind of a game of trial and error, where you don't know what it's looking for. There's random parameters that I just know how to send, because I was like, "What if I add this?" Eventually, it started returning what I wanted it to. [Gideon later expanded on this idea in a follow-up message: "Why do they make the video play-by-plays available? Who is it for? If it's for the fans, then why don't they make it available to developers instead of making us sift through their website for hours on end?"]

I'm technically doing something that stats.nba.com doesn't want me to do. I would love to publicly share the code, but it would take someone two seconds at stats.nba.com to look at the code and be like, "All right, we can block this easily." [He later clarified: "They would never be able to fully block us, it's more that they could just routinely make changes that would break our code. Meaning we'd have to go back in to figure out what's going on."]

I don't want that to happen. Once it stopped working, the only other option is, you need to have a computer that is running all the time. Do you know what a Raspberry Pi is?

That's one of those little baby computers that you can set up with a few parts?

GR: Exactly, exactly. It's a $40 computer that is super-minimal, but super-powerful, and there's a lot of DIY shit that is super-rad. Basically, I just wrote it so there's this Raspberry Pi in my one-bedroom apartment that serves no other purpose other than to tweet out random NBA plays.

That's awesome. I mean, hopefully after this prestigious article, the NBA will give you a carve-out and let you set up a more straightforward method for it. But the ingenuity is amazing.

GR: Thank you. Yeah, our next big step is we'll have to be down for some time, because I'm moving out of my apartment. I'm not gonna have WiFi, so I'm going to give the bot to Louis.

LK: So excited to have the bot, and bathe the bot, and love the bot.

When you say random play, what is the pool of plays being selected from, and how do you pick from it randomly?

GR: There's actually a flaw in it. The system is basically based off of how their system works. First I select the season, and it only started from 2016. In code, there's ways where you give it a selection, and you say ".sample," and it picks one at random. I go 2016 to 2020, and then I get one of those. Then—this is where the flaw comes in—the first request that I make, it returns all the months of that season. It divides it into October, November, December, and so on. I pick a month, and within the month, I pick a game, and within the game, I pick a play. The problem is that the only games in June are Finals games. Any time June gets picked, it's a Finals game. It just feels like there's more Finals plays than anything else.

Not the worst problem, but I see what you're saying.

GR: Right. I don't have a good solution for it, but I was just like, Fuck it, I'm leaving it.

What's something that you guys were happy to be reminded of by the bot? Is there some random residue of an NBA game or season that you forgot you missed?

GR: For me, one of the delightful things that I've seen from it is just how arbitrary it feels like assists are. It's something that we knew already, but just all the stats that the official's recording, and you see it happen, and you're just like, I don't know about that. That's my number one takeaway. What I think everybody else's biggest takeaway is, if you dislike a player, seeing him throw up a brick—on [Nov. 21] I texted Louis, "Nothing gets the fans going like a brick." Louis replied, "Yeah, like a [Kyle] Kuzma brick," and then three days later, Kuzma threw up a brick, and then our bot has grown 20 percent since then. People love to extrapolate. Whatever happens is, Oh, this is what this player does all the time. Maybe it's true, because it is a truly random sample. Over time, maybe, we get 15 Kuzma bricks.

LK: I feel like everyone's exposed on the bot. The thing it reminds me about is the aesthetics of the pre-bubble NBA. The first thing I notice now is always the fans and how people react when something happens. During the bubble, they were actually piping in fake crowd noises and trying to mimic how fans would react when things happen, but there was no way to organically use the airball chant, like when someone airballs. Your brain is actually conditioned to anticipate those cues when you see them in the game, and even [in] these nine-second clips, you get that back.

The sounds that the ball makes, when it comes off the rim, because you're watching an eight-second clip on the bot, it inevitably loops, and then you hear the same hollow ball sound off the rim, over and over again—it's really soothing.

Also, overall, the way that we watch clips of games, especially on Twitter, is with this film-room approach. I think that this the bot has been a nice aesthetic counterpoint to the film-room element. Nine-second clips are constantly being mined for strategy. Even on YouTube highlights, you can get an eight-minute video of James Harden's game where they show you a clip of every rebound that he gets and every made shot, and it's a player success reel. This is more truthful. It's a little bit awkward, the way that the clips are cut. You have the rebound happen in the beginning of the clip, and then there's eight seconds of a guy bringing the ball up the court.

I love that.

LK: Yeah, the fact that you don't really know what you're looking at when you first play the clip, it allows you to enjoy the non-strategic aspects first.

Yeah, I definitely view it as a palate cleanser on my timeline when everyone's kind of thirstily, like you said, mining the game for all its little insights. Where I just want to see this unpretentious, meaningless, Zen-like clip in the middle of that. It's nice.

GR: That brings up Louis and my favorite type of play, which is an "End Period." When the quarter ends, that's just how they log the end of the quarter. It says "End Period" and it's just people doing weird shit at the end of the game, or someone hurling a 90-foot shot.

LK: Or it's the end of the first quarter, so someone will just be dribbling and not taking the shot. Or watching Mario Hezonja kick the ball out of bounds.

So that's a good example, and then the assists are a good example—I actually used to trawl through those videos and gawk at them too—but are there any other oddities about how the NBA labels plays? Things that just pop up on the bot that you wouldn't expect?

GR: The one thing that annoys me so much … everybody goes by their last name. Even the Currys, and you would think that it would say Seth Curry or Steph Curry, right? But for some reason, everybody uses their last names—except for the Morris twins, but it's not the full Morris twin name, it'll just say "Marc Morris," or "Mark Morris." I understand that the C and the K are the first differentiating letters in their names, but why not do that for Seth and Steph? Maybe something about [how the Morris twins] were on the same team at the same time, I don't know. I really don't get it and it really annoys me.

LK: My counterpoint—this isn't about the names, but one thing that that it doesn't have is replay reviews. That's my soapbox: So much of our time spent watching these games is on replay reviews. They become increasingly hard to parse as to what the point of replays is. That just doesn't happen on the bot. It's always action.

Right, that's a good point. You don't get any of the weird, legalistic, trying to figure out what the hell happened in extremely slow motion. Aside from Kyle Kuzma schadenfreude, what else really gets the people going?

GR: It's definitely the main one. This isn't really that interesting, but we do think we've seen an uptick in any Celtics play, so we feel like there's a pocket of Celtics Twitter that started following it. What else gets people going? It's really just any time that it's any trope. Harden with a bad pass, or a brick. It's really just the players that people like to shit on already.

LK: Yeah, there's the Celtics Twitter stuff, but I think also there's some plays that just have a good rhythm to them. I don't know, maybe I'm projecting, but I feel like those ones pick up likes for whatever reason. When someone makes a nice shot—I'm just scrolling through the feed now—and LeBron hits a three, that's got a bunch of likes.

GR: Once I get back to my computer, I can also pull the most engaged-with tweets and try to figure out what it is.

[Update: "This is our most engaged-with tweet from October. No idea why. It's not even the funny Lopez twin!"]

LK: There's ones that are just naturally funny in one way or another.

Definitely. There's just a deadpan quality to it. I agree with what you're saying: Some clips just have a good flow to them. Someone will get a stop. Then it's not even what the play is supposed to be labeling, but the next eight seconds will just show them going back and transition the other way and making a layup, and that was sweet. That's not even what I bargained for when I read the description. Very satisfying twist.

GR: Yeah, that's the best part. It feels like sometimes what the record is is the least important part of that play. Someone had a tip-back, but that was in the first two seconds, and then the ball swung around and there was an ugly shot or something. I mean, I guess that was part of the play, but that's not how I would describe this video.

You're coming up against the tension between how a human would describe a given eight-second passage of play and how this robot would.

GR: Exactly. But it's also—the video clips has three different stats in it. They logged each one of those. If you have a tip-back, they'll log the rebound as well. This doesn't happen a lot, but I've seen a couple where the play isn't even in the video. You're just like, I don't know what's going on here. That was either before this or after this.

An interesting question would be: What NBA play is most indexed in the most different ways, is most tag-dense, and most likely to come up on this bot?

GR: Yeah, I could probably spend some time trying to figure that out. Speaking of indexing plays, I do quickly want to give a shoutout to 3ball.io. I think it was how I figured out that it was possible. I DMed them a couple times, and they pointed me in the right direction. I think what they do is index every single play, and then make it searchable, so it's a lot more heavy lifting.

Cool. Are you guys let down at all, or what do you feel, when it actually spits out an objectively cool play?

LK: I always feel it doesn't have enough followers. From the very beginning, I've been totally awed at what it produces. Maybe that's because I didn't build it myself. But I feel like it's an art piece. People should be paying attention to it. The bot, you know, it's a prophet.

GR: People today [Nov. 24, the day Marc Gasol signed with the Lakers] were asking, "It feels like it's rigged?" because there was a Gasol play.

LK: Right when [Ricky] Rubio got traded, the first play after was a Rubio play from his Minnesota days. That's the other thing we didn't mention earlier: When we first made it, it was just 2018, 2019, and 2020. We expanded it later. It's cool to see literally anything, even when it spits out complete garbage, that's part of the game too. My problem is I can't watch NBA games for longer than 15 seconds at a time now. Once they brought the NBA back, I was like, What is this longform play?

You and the rest of the House of Highlights generation, am I right? Kids don't know how to watch sports anymore.

LK: Mixtapes used to be good. No offense to the grinders who put out the highlights now. They used to have cool music and different angles. But now it's just James Harden driving to the hoop over and over again. The only good ones are high school tapes, actually.

Yeah, they've gotten more mechanical and completist, I would say.

LK: But also the game has gotten more boring. I would be interested in a bot from [the] 2005-2006 season. Just the homogeneity of today's game has foreclosed on the idea of cool YouTube highlights in a way, because the players aren't as stylish in general. There's 50-70 DeMarre Carroll-grade players in the NBA.

If you liked this blog, please share it! Your referrals help Defector reach new readers, and those new readers always get a few free blogs before encountering our paywall.

Stay in touch

Sign up for our free newsletter