Exemple #1
0
    def __getMissionBeanFromRedis(self, requestKeys):
        random.shuffle(requestKeys)  # 随机乱序
        for redisKey in requestKeys:
            keyNow = redisGetBiggetDeepKey(3, redisKey)
            if keyNow is None:
                print(redisKey + '_redis 无任务(不存在任何key)')
                time.sleep(1)
                return None

            strMissionBean = json.loads(redisRPop(3, keyNow))
            # 下载队列为空
            if strMissionBean is None:
                print(redisKey + '_redis 无任务(key中不存在missionBean)')
                return None

            missionBean = MissionBean("", 0, [])
            missionBean.__dict__ = strMissionBean
            missionBean.downloadMethod = redisKey
            return missionBean
from zywa_database_core.dao.mongo.mongoClientMyself import MongoClientMyself
from zywa_extract_helper.model.missionBean import MissionBean

if __name__ == '__main__':
    __mongoClient = MongoClientMyself(host="172.10.3.219",
                                      port=20000,
                                      db="xiaociwei",
                                      user="******",
                                      password="******")
    items = __mongoClient.selectAll(tableName='iqiyi_video')
    i = 0
    for item in items:

        missionBean = MissionBean('', 0, [])
        missionBean.__dict__ = item
        print(i)
        print(missionBean.title)
        redisLPush(4, 'data_clear_' + str(missionBean.type),
                   missionBean.getRedisDict())
        i += 1