Skip to content

Commit

Permalink
Only check a post if the owner_rep is <= 50
Browse files Browse the repository at this point in the history
No need to run the regexes if we're just going to discard the result.
  • Loading branch information
csnardi committed Jul 2, 2015
1 parent 859ed18 commit 191de64
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions bodyfetcher.py
Expand Up @@ -85,12 +85,13 @@ def make_api_call_for_site(self, site):
owner_rep = 0
q_id = str(post["question_id"])

is_spam, reason = check_if_spam(title, body, owner_name, owner_link, site, q_id, False, False)
if owner_rep <= 50 and is_spam:
try:
handle_spam(title, owner_name, site, link, owner_link, q_id, reason, False)
except:
print "NOP"
if owner_rep <= 50:
is_spam, reason = check_if_spam(title, body, owner_name, owner_link, site, q_id, False, False)
if is_spam:
try:
handle_spam(title, owner_name, site, link, owner_link, q_id, reason, False)
except:
print "NOP"

classified, gibberish_score = classify_gibberish(body, site)
if classified and gibberish_score >= 65:
Expand All @@ -115,12 +116,13 @@ def make_api_call_for_site(self, site):
owner_link = ""
owner_rep = 0

is_spam, reason = check_if_spam(answer_title, body, owner_name, owner_link, site, a_id, True, False)
if owner_rep <= 50 and is_spam:
try:
handle_spam(title, owner_name, site, link, owner_link, a_id, reason, True)
except:
print "NOP"
if owner_rep <= 50:
is_spam, reason = check_if_spam(answer_title, body, owner_name, owner_link, site, a_id, True, False)
if is_spam:
try:
handle_spam(title, owner_name, site, link, owner_link, a_id, reason, True)
except:
print "NOP"

classified, gibberish_score = classify_gibberish(body, site)
if classified and gibberish_score >= 65:
Expand Down

2 comments on commit 191de64

@Undo1
Copy link
Member

@Undo1 Undo1 commented on 191de64 Jul 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, brilliant. :)

@Manishearth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Please sign in to comment.