Placeholder Image

Subtitles section Play video

  • what's going on?

  • Everybody And welcome to a creating a reddit bought tutorial in Python.

  • So what we're gonna do in specifically is creating a reddit bought that goes through and detects Reddit Spam and affiliate Link specifically in this case to you, Demi.

  • But we could very easily modify this to detective.

  • Quite a bit of spam.

  • Um, so overlooked the last year I've noticed this is crazy sharp incline in the amount of just you Demi affiliate link Spam coming in to read it.

  • And it's hard, I think, to catch because they're not necessarily directly linking tow you Demi.

  • They're kind of linking to some other tracker site that then links to you, Demi.

  • So a lot of times they link to a Twitter post that links to you Demi or links to a trucker site that links to you, Demi or they linked to a medium posed and so on.

  • Um, now that seems to be on the decline.

  • And now they're actually not even doing that extra step.

  • They're they're actually just linking direct to, um to the tracker site.

  • Then which goes to you, Demi and they're not even being kind of hidden about it most of time.

  • They're saying you Demi and all this kind of stuff.

  • So anyways, I thought about writing about a long time ago to do this and detect this kind of spam.

  • But there are just so many other things I want to spend my time.

  • I didn't really feel like doing it.

  • Uh, that was until a few days ago I found, um, some red.

  • It's spam.

  • Do you have to you Demi course that was actually a Pirated course of my course is a direct ripped from YouTube.

  • Even the author's bio on you, Demi, was a rip from h kingsley dot com.

  • So just a total Pirated.

  • Um, course.

  • And this was being spammed on reddit.

  • So, uh, why don't you know?

  • I found some time I found some motivation, wrote the body, So here it is.

  • I'm gonna run through it with you guys.

  • We're not gonna be writing it line by line.

  • I'm gonna kind of copy the method I did with the latest one of the latest tutorials.

  • If you want to learn more about working with prosthesis, thickly go to the project, Auriol.

  • Siri's like this is just gonna be apart for of that Siri's, um so if you want to learn more about interacting with the red objects and stuff like that, check that out.

  • This is really just a application, me just kind of showing you it's going to use.

  • So the first thing that we're gonna want to do obviously have a reddit accounts set the AP I again go through.

  • The process is if you don't know how to do that but basically making account, go to your account preferences app, create the app, make sure it's a script up.

  • Um, that's about it.

  • Really.

  • Um, fill out the form.

  • So once you've done that, you'll have your credentials client I d.

  • Secret password, user agent, user name.

  • I'm putting these into a prat Underscore creds dot pie.

  • This is a copy of that because the real one actually has my real values and I don't want to go to you.

  • So anyway, um and then I've got a to catch a press to catch a scammer dot pie script.

  • So with that, let's go ahead and get started.

  • The first things we need to do is import that Prock Reds, the client I d oh, by the way.

  • You don't have to write all this out.

  • Have a link of description to this tutorial.

  • Also, the code is on Get hub.

  • Um, so if you want to contribute or check out the code or whatever, it's it's up there.

  • I'll put a link in the description, but it's just ram spam.

  • Read it.

  • Spin detector bought.

  • Okay, so, um, once we've got that, the next thing that I want to do is basically we create the reddit object itself, passed through all the credential stuff and all that, and then we kind of have to figure out Okay, how are we gonna catch these people?

  • How are we gonna figure out who's a spammer who's not?

  • Because just because someone's posting a link that does go to you.

  • Demi doesn't necessarily mean that they're a spammer.

  • I mean, they're probably a spammer, but we can't just assume at that point that they're a spammer.

  • So what we actually need to do is probably go through all of the posts, but then let go through post that are linking to you Demi stuff.

  • But then also go to that user name and then check out that username or all of their posts to you Demi junk or is just some of it or, you know, whatever.

  • Because sometimes, like I thought it was probably course creators, just the course creator that create the course.

  • And then they went thio read it to kind of spam it out, But no, these air definitely massive spam rings.

  • So, um, I found so much like their huge, um I didn't realize how big this problem was until I really started looking into It's pretty.

  • It's pretty nuts.

  • Um, anyway, so what I've done here is I'll pull up.

  • Um So, for example, let me pull up my little bought guy.

  • Um, so this is my spam detector bought.

  • And basically, what he does is he just, You know, he just going to these threads and just post this message, basically.

  • So I get in this case, this guy, um, I don't even know this name.

  • It's just a spam name.

  • Um, we're just saying, Hey, you know, six a third of these 33 submissions from this user appear to be you Demi affiliate links.

  • And the reason we could know that is, if we actually go to this user account.

  • We just click on it and we can see, like, look at all of these courses.

  • Really 100% of these air courses, In my case, we're just looking for the term you Demi.

  • Um, but in time, I plan to expand that out because obviously, especially once somebody figures out that I'm looking for the term you Demi, they'll just remove the term you Demi.

  • So, um, so that'll that'll change for sure.

  • We'll come up with better words and stuff and, uh, ways to match courses.

  • There's lots of little things.

  • I'm not sure I'm gonna go over all of them.

  • I don't want to give away the tricks to the trade.

  • Um, but anyways, uh, yeah.

  • So it's pretty quick and easy to go to these people's page and figure out this is a spam bots or a spammer.

  • I'm actually not confident these air bots.

  • I think it might actually be human behind them.

  • Anyways, we're gonna move these aside now, so that's what we need to do.

  • We need to get to this user and look through his content.

  • So, um, so that we can do all of that with the python Reddit a P I rapper.

  • So what we're gonna do first is find a spa.

  • Just find spam by a user name.

  • So the function that I wrote for that or find spam and then return the user names.

  • So basically, what we're gonna do here is we're just gonna go through a search query and just log all of the author's right.

  • Um And then what we're gonna do here is let's just generate through that real quick just to show you an example of it running so paste, and then I'll run that.

  • So here we have just the list basically just ran through.

  • Um, you know, the posts.

  • And then here are the users.

  • So all of these people are suspicious, at least, But again, these are just people who have posted about you, Demi.

  • We don't know anything more about them.

  • So we really kind of want to dig a little deeper into these users toe really determine whether or not they're there spammer or they're just a regular person, um, sharing a link to their course.

  • So now when I go ahead and Dio is just overwrite this kind of loop here, and so instead what we're gonna do is we're gonna search for Query.

  • And right now, we're just gonna random choice for you Demi again.

  • Later.

  • I would add many, many more terms to that.

  • Because again, if we're just looking for you, Demi, if these spammers were to find out that that's the one thing that is the crux to this entire cut, just stop posting you, Demi the Just stop using that word because it's really not essential.

  • Um, so anyways, once we find that we're gonna have spam content, trashy users, and then basically smell the authors, we don't know if these authors air trashy, but they smell bad.

  • So we're gonna figure out, um, a little bit more about them.

  • So also were using random here, so let's go ahead.

  • And at this stage, we need thio import random.

  • Okay, So once we have these smelly authors, we want to start iterating through the smelly authors to figure out what their deal is.

  • So come down here, pay.

  • So I make sure we're not having a tab issue.

  • Good.

  • Um, and they make sure this is set right, And then So what we're gonna do is now we start iterating over those authors.

  • So for each author in smelly authors were going to say we're going to start counting.

  • How many trashy you or else do they have?

  • How many submissions did they make and how many of those submissions are dirty?

  • So then what we need wanna have is something that is, like, common spammy words.

  • So I'm gonna actually come up to the top here.

  • You just paste that in so common spammy Weren't worms you Demi course save coupon free discount?

  • As a matter of fact, really, A lot of these things, like for sure, course coupon discount.

  • Chances are, if someone has these things in there, it's probably spam.

  • But anyway, um and then if if the user continues, like again, if we just if we search for Spain, the words and then we only matched these spammy words.

  • If, like more than 50% of a user's content is always this junk, they're a spammer.

  • So So anyway, that's just again to point out, you know, the you Demi should not be the only word that you're going to use.

  • I'm just gonna do it for this tutorial.

  • I don't want to give away all the great words.

  • Um, but we'll see.

  • I'm gonna have it up on get hub for a little bit.

  • If people contribute, then we could probably leave it open source, and it won't be a big deal of people can say ahead of it, But this isn't exactly the most exciting task in the world, so I'm not really sure how many people are gonna help, but it's ah, it's kind of fun to combat these guys.

  • Anyway, um, next thing that we're gonna dio is, uh, run.

  • Basically want to run through their submission.

  • So we found the author.

  • Now I want iterated over that author's submission, so we want to visit their profile.

  • So I'm gonna paste in that chunk of code the museum at a little bit there, so it all fits.

  • So we want to throw a trying except into here, mostly because the Post might have been made by that author.

  • But the's authors, air spam authors, they're they're going to eventually be removed from reddit.

  • So when that happens, sometimes these users will return error codes if you try to access them.

  • Otherwise, what we're gonna do is, um basically, we're gonna say it's for submission in that red eaters and then string author because at this point, author is actually an object.

  • It's an author, object from the reddit instance.

  • So from whatever that authors, user name is their submissions ordered by new, we're gonna start iterating over them.

  • So we're going to see where that submission links to.

  • At the moment, I don't actually think I'm using this, but this is another great thing to track to figure out if someone's a spammer right now, they're using the same kind of websites.

  • So one you could figure out there a spammer, but to you could also link them to other spammers.

  • And this is what I started to do to identify the networks themselves.

  • So the people that are spanning two the same kind of trackers, they're pretty much all connected and given the fact that they all have very similar usernames, um, I'm gonna go ahead and say it's probably the same group that's doing this, but anyways, moving right along I'm not actually using that right now.

  • I don't think, but it's still something good to track.

  • Otherwise, we take the I.

  • D.

  • S.

  • O.

  • We can quickly get to it.

  • Um, actually, I'm not even sure we're tracking that anymore, because I think we just get the girl to it.

  • But anyways, um, we also want tracked subreddit again, just in case there's, like a you Demi freebies subreddit that is basically all affiliate spam.

  • So I think everybody in that subreddit probably knows exactly what that subreddit is.

  • It's like literally probably four spammers.

  • Um, so not really sure would say about that.

  • Honestly, I feel like that sub should just be deleted.

  • Um, implants, whatever.

  • Um but then we're gonna say dirty equals false, and then we're gonna do is we're gonna generate through the spam E words.