Dueling supporters: right, with a poster of President Hassan Rouhani, and left, with one of Ebrahim Raisi, in Tehran on Wednesday. Vahid Salemi/Associated Press

Dueling supporters: right, with a poster of President Hassan Rouhani, and left, with one of Ebrahim Raisi, in Tehran on Wednesday. Vahid Salemi/Associated Press

It was 3 a.m., and I was at a bar in Crown Heights, Brooklyn, when I first got the notification on my phone. President Hassan Rouhani of Iran, who is seeking a second term, was broadcasting a live video on Instagram. It’s impossible to get Instagram videos once they are no longer live, so this was my one chance to catch Mr. Rouhani’s speech. I ducked into the bathroom to listen in. Then, about 20 minutes later, Ebrahim Raisi, the hard-liner candidate, started a live stream of his own. The bartender and people sitting at the bar watched as I went back and forth to the bathroom wearing my headphones, clutching my phone and whiskey.

Iran has blocked Facebook and Twitter since the 2009 antigovernment protests. For the first time, candidates were using unblocked social media platforms to get around state media restrictions. In a country where nearly one third of the electorate is under 30, reaching young people is crucial. And young people there are like young people here: They live on social media, and both candidates’ meant to meet them there. I decided to produce a video for The New York Times website that looked at their efforts. On Friday, the day Iranians head to the polls, we will see how successful those efforts were.

This article appeared in print on A2 on May 19, 2017. Read the rest of the story here.