Ejemplo n.º 1
0
 def savePageInfo(self, pageIndex,region):
     lists = self.getLists(pageIndex,region)
     if(lists == None):
         print (u"本次找到美女", 0, u"位,地区",region,u"页数",pageIndex)
     else:
         print (u"本次找到美女", len(lists), u"位,地区",region,u"页数",pageIndex)
         for item in lists:
             print (u"发现一位模特,名字叫", item['realName'])
             # print u"身高", item['height'], u"体重", item['weight'], u",她在", item['city'], u",点赞人数", item['totalFavorNum']
             # print u"正在偷偷地保存", item['realName'], "的信息"
             # 获取个人详情
             infos = self.userinfo.moduleInfo(str(item['userId']))
             item['detailURL']= 'https://mm.taobao.com/self/aiShow.htm?userId=' + str(item['userId'])
             dictMerged = dict(item, **infos)
             #将基本信息和个人详情合并,存入数据库
             mongo_collection.update({'id': item['userId']}, dictMerged, upsert=True)
Ejemplo n.º 2
0
def search():
    """按照上海各个区和年龄段进行搜索"""
    for city in range(1, 20):
        for age in range(22, 27, 2):
            data = {
                'province': '2',
                'city': str(city),
                'age': '{}-{}'.format(age, age + 1),
                'condition': '1',
            }
            response = session.post('http://love.163.com/search/user/list',
                                    headers=SEARCH_HEADERS, data=urlencode(data))
            if not response.ok:
                print ('city:{} age:{} failed'.format(city, age))
                continue

            users = response.json()['list']
            for user in users:
                mongo_collection.update({'id': user['id']}, user, upsert=True)
Ejemplo n.º 3
0
def search():
    """按照上海各个区和年龄段进行搜索"""
    for city in xrange(1, 20):
        for age in xrange(22, 27, 2):
            data = {
                'province': '2',
                'city': str(city),
                'age': '{}-{}'.format(age, age + 1),
                'condition': '1',
            }
            response = session.post('http://love.163.com/search/user/list',
                                    headers=SEARCH_HEADERS, data=urlencode(data))
            if not response.ok:
                print 'city:{} age:{} failed'.format(city, age)
                continue

            users = response.json()['list']
            for user in users:
                mongo_collection.update({'id': user['id']}, user, upsert=True)
Ejemplo n.º 4
0
def set_satisfy():
    """设置是否满意"""
    mongo_collection.update({'url': user['url']},
                            {'$set': {
                                'satisfy': satisfy.get()
                            }})
Ejemplo n.º 5
0
def set_appearance():
    """设置头像评分"""
    mongo_collection.update({'url': user['url']},
                            {'$set': {
                                'appearance': appearance.get()
                            }})
Ejemplo n.º 6
0
def set_satisfy():
    """设置是否满意"""
    mongo_collection.update({'url': user['url']},
                            {'$set': {'satisfy': satisfy.get()}})
Ejemplo n.º 7
0
def set_appearance():
    """设置头像评分"""
    mongo_collection.update({'url': user['url']},
                            {'$set': {'appearance': appearance.get()}})