Getting officers and documents from Indiana’s Secretary of State

Today is a short, focused video where I add officers and documents to the state of Indiana in the Secretary of State API.

If you are looking for an API key you can get one here – https://cobaltintelligence.com/secretary-of-state

We use Puppeteer on Lambda for Indiana and solve captchas doing so.

If you need help solving captchas with Puppeteer, you can check this post here – https://cobaltintelligence.com/blog/avoid-being-blocked-with-puppeteer/

Transcript

Hello there. Um, well I just go here, I guess first I’m Jordan Hanson from cobalt intelligence. We’re talking about more secretary of state API stuff today. Today we are going to actually want to make this bigger. There we go. Um, today we’re gonna go to Indiana. We’re going to start adding officer information.

So we’ve already added it to a few states, Kentucky, Florida. And I’m gonna start with Indiana today. Indiana is kind of a pain because it has a bunch as a capture and, you know, Anytime you refresh a page, it’s pretty much, you got to do the capture again, this is kind of a pain, but, um, it should be pretty simple adding this.

Um, I think it might be as simple as I want to look at how I had this originally were going through. Um, it looks like, okay, we’re using, okay, we’re using puppet here. Sorry. It took me a second there to realize where we’re doing, where we have puppet puppeteer. We agreed in the rows and we’re going to all the cells.

I think I can just, I want to see if I can just get this. Here I can look, see, I guys principal information. I like that. So about this, this, we can say, I think it would be something like this. If I can make that bigger a little bit, Hey, would go principal information and then we’ll go every row inside there or inside T bodies and T body tr looks at that.

So let me start easy with guys are two of these.

Is there. Oh yeah. That’s why I want this table. There we go. Perfect. That we’re going to have this constant officer’s equals await page. That dollar dollar, hopefully it’s going to be kind of a quick one and we’ll look through those four eye officers that length officer, and then we’ll go. We’re going to say.

Yeah. So we’re going to look through our officers and then we’re going to say cons title equals await page that you Val, and it’s going to be TD probably at the type one, one element element, a text content. And I’m going to say that trim right here. Whenever you do this, the auto complete will look at that mess.

Auto-complete right. There automatically adds a way. So we’re going to go out like that. And then we’re going to say name it’s probably gonna be the second one address is going to be this big when I address and we’re going to go through pick and look. Okay. So, yep. Right there, right there, right there.

Perfect. And then we’re going to say if business details dot officer’s, if exists already, then we’re just gonna push it into it. Now we’re going to say. Push into array else. If it doesn’t exist, um, create, create, create, okay, there we go. I’m gonna go with that. And then we’re going to say. What are we going to say something here?

I’m worried about this address. I got to parse it, but otherwise the rest of it should be easy. We just go off the business that officers stopped push to be name, name, title, title, and address street address. That’s where we’re going to parse this stuff. I think I already have a function here. Let’s see if I can do that in equals parse address.

And I think this is part of that. Yeah, it’s common in between there and we’re the pass an address. And then we’re going to get this street city, state zip right there. Street, city,

state, zip, zip, right. That we got like this. And actually, why don’t we go with this constant officer?

Oh, this shouldn’t be that this is going to be, I’m going to make this officer row and it should be like this. And then we’re gonna say, officer equals, I’m going to make this, I’m gonna go with this. I officer let’s make a little bit better. Can I have that somewhere? Yeah, right there. And then all this, but I want.

I’m going to do this once. And we push right here, officer, uh, and off officer. There we go. If it’s not, if we don’t have a rate yet we’ve got business at officer’s equals and array inside that we’re going to have officer like that. Bam, just like that. I think we got off. Who’s with me. All right. So now we’re going to say, get status.

We’re going to get good commit the new thing we can do, where we can it’ll automatically deploy in the end, add officer’s origin to automatically deploy as it goes. And so why this is deploying right there. We’re going to go over here to filing history. We have some articles of organization. Is there anything in there that I can use as have we have a URL as a, based on the ID now it’s not, which means we’re going to have to click it.

If I click on filing history. Okay. I got to do that await page.click, and it’s going to be whatever that filing history thing is, this thing it’s going to be.

What that number is my letter, this weight fighting history, have program click on that, and then we’re going to wait it out. Wait for selector. Wait for that thing to show up.

Now let’s just confirm. There we go. There. Yeah.

And we’re, it was really fast. I’m going to put time into five seconds here should take, should not ever take longer than that now. Uh, I just want to confirm this thing isn’t here right now. It’s not. And wait before we get too far, when I go over here and the SDK, I’m gonna run it against Indiana. What is this there?

I want to make sure that. And we’re saying to Indiana, is that I N I ain’t. Okay, perfect. I’m going to dev, okay, so we’re going to send it there. It’s going to take a second because Indiana has a capture, so we’ll let it run. And then while it’s going, it should be turned in array with the thing in there, and now business Subaru.

Now we’ve got this, we’re going to come in here and that we should,

should like this. It’s got all the documents now. It’s gonna be the same. I probably did have to get that intense, but it’s probably, to me, something like this, watch this table is going to be business filing. Yeah. That’s what I’m looking for. And I say cons to rows document rows equals awake, page dot dollar sign, open hash.

There we go. I would, I just do the business filing and I want. T body T R I think T body, here we go.

Can I go T body type one? Because it looks like it’s tables. I’m an ID. And there’s also one for the pagination. I don’t want that of type one. Maybe has still. What about just the first one? Oh, no, it should be

tape that, there we go. That’s what I want.

There we go. And then we’re gonna look through them. I’d say four. I documented rows document row, and this needs to be dollar sign dollar sign in the re. And they would go in this. I think the title and the link title is going to be

wait, document, row evil. It’s going to TV and of type what? For 1, 2, 3, 4, it’s going to be a.

That’s content that trim could read this await. And then I also want the patron

that’s going to be attribute. Gotcha. Yeah. Right there. And then that is going to go like this. We’re going to say business. Document equals high document, and now we should be able to import that same way. Come on, please. There we go. All right. And now we need a title name. Okay. H URL, probably. There we go.

And now it’s going to be slash I’m assuming it’s going to be this and. Hey track should be URL. Really?

There we go like that. And then we say, if business dot documents, then we push push document. Otherwise what do we do then we make it same way. Business documents equals document. Perfect. And let’s see how we’d debate. Oh, we got some officers. I’m not lugging it out, but I’m going to send it up. Actually.

Let’s say add documents. Oh boy. That’s on thing. Oh, wait. No, that’s right. Okay. And meanwhile, I’m gonna go over here and say details zero officers like that. It’s going to take a while though, Dan, I think we might be done with Indiana that easily, then we’ll be good. That was quick, not so bad. Right? I didn’t know if the officers some click that fight in history.

We wait here. Now what happens there? Isn’t a fighting history. This would fail. Kind of imagine there ever not being one. I kind of want to go over here. Kentucky. I have all these where I’m saying, why separate it based on certain articles? What if I don’t? What if I just do all documents? Think I’m just good to all documents St.

Pete, Florida.

I think I just had the last one.

oh, well that one they stay and they’re bam tip state. Remember? Yes. That’s an officer right there. My friend now documents is coming up. So as soon as that thing gets deployed, we can do documents, Kentucky. We can probably send up. Okay. That’s good. So we’ve got Indiana office. And documents added non prod yet.

We’ll get those out probably today, but there we go. All right. That’s it. That’s how we do it. You saw how we did that. There, we selected the ones that we wanted just right here really quickly. And then we looped through added the ones where you’re picking took two chick. Not they’re not there. This should never fail.

Right? There’s no officers there shouldn’t be any rows. And then it won’t go. All right, let me see Indiana for us done.

Hey there. Want to be friends?

I'll be straight with you. I'm going to want to show off my web scraping genius. But I want to hear about your web scraping troubles and successes as well.

And I like you. So I won't be one of those weird friends who is always calling. What do you say?