Better spam logging.

This commit is contained in:
Samuel Clay 2014-09-17 13:40:57 -07:00
parent a19bc9f786
commit 2c41b3ae70
3 changed files with 13 additions and 9 deletions

View file

@ -9,7 +9,6 @@ import random
import requests import requests
import HTMLParser import HTMLParser
from collections import defaultdict from collections import defaultdict
from pprint import pprint
from BeautifulSoup import BeautifulSoup from BeautifulSoup import BeautifulSoup
from mongoengine.queryset import Q from mongoengine.queryset import Q
from django.conf import settings from django.conf import settings
@ -1511,8 +1510,6 @@ class MSharedStory(mongo.Document):
users = {} users = {}
for user_id, feeds in ddusers.items(): for user_id, feeds in ddusers.items():
users[user_id] = dict(feeds) users[user_id] = dict(feeds)
pprint(users)
guaranteed_spammers = [] guaranteed_spammers = []
for user_id in ddusers.keys(): for user_id in ddusers.keys():
@ -1522,9 +1519,16 @@ class MSharedStory(mongo.Document):
read_story_count = RUserStory.read_story_count(user_id) read_story_count = RUserStory.read_story_count(user_id)
feed_count = UserSubscription.objects.filter(user=u).count() feed_count = UserSubscription.objects.filter(user=u).count()
share_count = MSharedStory.objects.filter(user_id=user_id).count() share_count = MSharedStory.objects.filter(user_id=user_id).count()
print " ---> %s (%s): feed_opens:%s feeds:%s read:%s shared:%s" % (
u.username, u.pk,
feed_opens,
feed_count,
read_story_count,
share_count,
)
if not feed_opens: guaranteed_spammers.append(user_id) if not feed_opens: guaranteed_spammers.append(user_id)
if (feed_count <= 5 and if (feed_count <= 5 and
feed_opens <= 5 and feed_opens <= 10 and
read_story_count < share_count*2): guaranteed_spammers.append(user_id) read_story_count < share_count*2): guaranteed_spammers.append(user_id)
print " ---> Guaranteed spammers: %s" % guaranteed_spammers print " ---> Guaranteed spammers: %s" % guaranteed_spammers
@ -1534,7 +1538,7 @@ class MSharedStory(mongo.Document):
user = User.objects.get(pk=spammer_id) user = User.objects.get(pk=spammer_id)
user.profile.delete_user(confirm=True, fast=True) user.profile.delete_user(confirm=True, fast=True)
return users, guaranteed_spammers return guaranteed_spammers
@classmethod @classmethod
def get_shared_stories_from_site(cls, feed_id, user_id, story_url, limit=3): def get_shared_stories_from_site(cls, feed_id, user_id, story_url, limit=3):

View file

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>4.1.0</string> <string>4.2.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -58,7 +58,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.1.0</string> <string>4.2.0</string>
<key>FacebookAppID</key> <key>FacebookAppID</key>
<string>230426707030569</string> <string>230426707030569</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>

View file

@ -3551,7 +3551,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -3590,7 +3590,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",