def get(self): """ :return:获取所有公众号列表 """ l11lll111_wcplus_ = [] l11lll1ll_wcplus_ = 0 l11ll11l1_wcplus_ = 0 l1l1l1lll_wcplus_ = l1l1l11l1_wcplus_.get() cnt = 1 for i in l1l1l1lll_wcplus_: l11lll1ll_wcplus_ += 1 l11ll111l_wcplus_ = l1l11llll_wcplus_(i['nickname']) l11ll1lll_wcplus_ = {} l11ll1l11_wcplus_ = l11ll111l_wcplus_.count() l11ll11l1_wcplus_ += l11ll1l11_wcplus_ l11ll11ll_wcplus_ = l11ll111l_wcplus_.count(read_num={'$gt': -2}) l11ll1lll_wcplus_['id'] = cnt l11ll1lll_wcplus_['nickname'] = i['nickname'] l11ll1lll_wcplus_['total_articles'] = l11ll1l11_wcplus_ l11ll1lll_wcplus_['reading_data_articles'] = l11ll11ll_wcplus_ l11ll1lll_wcplus_['time'] = i['time'].timestamp() cnt += 1 l11lll111_wcplus_.append(l11ll1lll_wcplus_) return { 'finished': l11lll111_wcplus_, 'stat_data': { 'gzh_num': l11lll1ll_wcplus_, 'article_num': l11ll11l1_wcplus_ } }
def l1llll1l1l_wcplus_(self, num=None): """ :param num: 如果是具体数字则 准备最近发布的num篇文章 :return: 根据公众号的昵称准备该公众号的所有或者前n篇文章的全部数据 如果某些字段没有就使用默认值 """ from pymongo import DESCENDING l1llll1l11_wcplus_ = [] col = l1l11llll_wcplus_(self.l1lll1lll1_wcplus_) if num: l11111l1l_wcplus_ = col.table.find().sort('p_date', DESCENDING)()[:num] else: l11111l1l_wcplus_ = col.get() begin_time = time.time() for doc in l11111l1l_wcplus_: item = {} doc['id'] = doc['content_url'] for key in l1llll1lll_wcplus_: if key in doc: item[key] = doc[key] else: item[key] = -2 l1llll1l11_wcplus_.append(item) logger.info('解析文章文本用时 %.3f' % (time.time() - begin_time)) return l1llll1l11_wcplus_
def __init__(self): self.l1l11ll1l_wcplus_ = rd.l1ll11l1l_wcplus_() self.nickname = self.l1l11ll1l_wcplus_[0]['nickname'] self.l11ll1l1ll_wcplus_ = 3.0 self.l11ll1l111_wcplus_ = len(self.l1l11ll1l_wcplus_) self.delay = round(self.l11ll1l1ll_wcplus_ / self.l11ll1l111_wcplus_, 3) self.l11lll11l_wcplus_ = [] self.l11ll111l_wcplus_ = l1l11llll_wcplus_(self.nickname) self.l11ll1lll1_wcplus_ = time.time()
def l1ll1111l_wcplus_(_1l1l1ll1l_wcplus_, l1ll11lll_wcplus_=128, process=None): global l11ll111l_wcplus_ global l1l1l1111l_wcplus_ global l1ll1l11ll_wcplus_ global nickname l1ll1l11ll_wcplus_ = process l1l1l1111l_wcplus_ = [] nickname = _1l1l1ll1l_wcplus_ l11ll111l_wcplus_ = l1l11llll_wcplus_(nickname) rc = l1ll11lll1_wcplus_() l1l1l1lll1_wcplus_ = rc.l1l1l1l11l_wcplus_( nickname, l1ll11lll_wcplus_=l1ll11lll_wcplus_, l1l1111ll1_wcplus_=1, l1l1llll11_wcplus_=l1l11lll11_wcplus_()) if not l1l1l1lll1_wcplus_: return rc.l1ll1l11l1_wcplus_() rc.l1l111ll11_wcplus_() l1l1ll1l11_wcplus_.l1l11ll11l_wcplus_()
def l1l1ll1ll_wcplus_(l1ll11lll_wcplus_=128, process=None): global l11ll111l_wcplus_ global l1l1l1111l_wcplus_ global l1ll1l11ll_wcplus_ global nickname l1ll1l11ll_wcplus_ = process l1l1l1111l_wcplus_ = [] from instance import rd nickname = rd.l1ll11l1l_wcplus_()[0]['nickname'] l11ll111l_wcplus_ = l1l11llll_wcplus_(nickname) rc = l1ll11lll1_wcplus_() l1l1l1lll1_wcplus_ = rc.l1l1l1l11l_wcplus_( nickname, l1ll11lll_wcplus_=l1ll11lll_wcplus_, l1l1111ll1_wcplus_=1, l1l1llll11_wcplus_=l1l11lll11_wcplus_()) if not l1l1l1lll1_wcplus_: return rc.l1ll1l11l1_wcplus_() rc.l1l111ll11_wcplus_() l1l1ll1l11_wcplus_.l1l11ll11l_wcplus_()
def l11ll1ll1_wcplus_(self, l11l1llll_wcplus_): """ :param page_info: {'nickname','start','end'} :return: 返回一个公众号的全部文章列表 """ from pymongo import DESCENDING l11ll111l_wcplus_ = l1l11llll_wcplus_(l11l1llll_wcplus_['nickname']) l11lll111_wcplus_ = [] cnt = 1 l11lll11l_wcplus_ = l11ll111l_wcplus_.table.find().sort( 'p_date', DESCENDING)[int(l11l1llll_wcplus_['start'] ):int(l11l1llll_wcplus_['end'])] for a in l11lll11l_wcplus_: item = {} item['id'] = cnt item['mov'] = str(a['mov']) if 'read_num' in a: item['read'] = a['read_num'] else: item['read'] = '-' if 'like_num' in a: item['like'] = a['like_num'] else: item['like'] = '-' if 'reward_num' in a: item['reward'] = a['reward_num'] else: item['reward'] = '-' if 'comment_num' in a: item['comment'] = a['comment_num'] else: item['comment'] = '-' item['date'] = a['p_date'].timestamp() item['title'] = a['title'] item['url'] = a['content_url'] item['md5'] = l11llll11_wcplus_(a['content_url']) cnt += 1 l11lll111_wcplus_.append(item) return l11lll111_wcplus_
# uncompyle6 version 3.2.6 # Python bytecode 3.6 (3379) # Decompiled from: Python 3.6.6 (default, Mar 29 2019, 00:03:27) # [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] # Embedded file name: instance\__init__.py """ 定义全局对象 """ from cmp.db.l1ll11l11_wcplus_ import l1l11llll_wcplus_ l1l1l11l1_wcplus_ = l1l11llll_wcplus_('crawler_log') l11l1l1ll1_wcplus_ = l1l11llll_wcplus_('req_data') from app.l1ll11ll1_wcplus_.l1l1l1111_wcplus_ import l1111_wcplus_ rd = l1111_wcplus_() from app.api.settings import l11l111ll_wcplus_ l1l1111ll_wcplus_ = l11l111ll_wcplus_() from app.l1ll11ll1_wcplus_ import l1ll1ll1ll_wcplus_ l11ll11lll_wcplus_ = l1ll1ll1ll_wcplus_() from utils.base import l1ll1l1llll_wcplus_ l1_wcplus_ = l1ll1l1llll_wcplus_()
def l111l1l1l_wcplus_(self): l111l11ll_wcplus_ = l1l11llll_wcplus_(self.nickname).get() return l111l11ll_wcplus_
# uncompyle6 version 3.2.6 # Python bytecode 3.6 (3379) # Decompiled from: Python 3.6.6 (default, Mar 29 2019, 00:03:27) # [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] # Embedded file name: app\api\settings.py """ 提供数据设置API """ from cmp.db.l1ll11l11_wcplus_ import l1l11llll_wcplus_ l11l11ll1_wcplus_ = l1l11llll_wcplus_('settings') class l11l111ll_wcplus_: def __int__(self): pass def get(self): """ :return: 获取所有的设置字段{} """ sd = l11l11ll1_wcplus_.get() l11l11l11_wcplus_ = {} for s in sd: l11l11l11_wcplus_[s['key']] = s['value'] from cmp.protect import Passport from utils.network import l111lllll_wcplus_ l11l11l11_wcplus_['uuid'] = Passport.l11l111l1_wcplus_() l11l11l1l_wcplus_ = Passport.l1l11l111_wcplus_() if not l11l11l1l_wcplus_: l11l11l11_wcplus_['passport'] = 0