Ejemplo n.º 1
0
Description :
接口查询的类,主要是接收参数(可查看__main__,进行测试),返回查询数据。
"""
__author__ = 'Luozheng'

import re
import datetime

from LOL.lolMongoClient import get_hero_name_by_another, \
    get_hero, lol_find_rank
from GOK.gokMongoClient import gok_get_hero, gok_get_herotypename
from MongoClient import user_find_type, insert_user_find_type, update_user_find_type, save_follower_to_mongo

from SpiderUtil.logUtil import Logger

log = Logger('../Log/gokSelenium.log', level='debug')

lol_game = ['英雄联盟', 'LOL', 'lol', '撸啊撸']
gok_game = ['王者', '王者荣耀', '荣耀', '农药', '王者农药']
teshu_list = ['罗正', '说明']
game_list = lol_game + gok_game
today = datetime.date.today()
yesterday = today - datetime.timedelta(days=1)


def hand_event():
    back_msg = '欢迎关注 英雄联盟 王者荣耀攻略\r\n\r\n初次关注请先输入查询的游戏名\r\n\r\n如【王者荣耀】、【LOL】'
    return back_msg


def hand_text_msg(xml_dict):
Ejemplo n.º 2
0
-------------------------------------------------
Description :
全局mongo的操作模块
"""
__author__ = 'Luozheng'

import pymongo

import sys

sys.path.append('../')

from Config import mongo_config
from SpiderUtil.logUtil import Logger

log = Logger('../Log/MongoClient.log', level='debug')

client = pymongo.MongoClient(mongo_config['MONGO_URL'])
db = client[mongo_config['MONGO_DB']]


def user_find_type(user_id):
    search_set = db[mongo_config['USER_FIND_TYPE']]
    list_tmp = search_set.find_one({'user_id': user_id})
    if list_tmp:
        return list_tmp['game_type']
    return None


def insert_user_find_type(user_id, type):
    search_set = db[mongo_config['USER_FIND_TYPE']]
Ejemplo n.º 3
0
import socket
import urllib.error

import requests
from bs4 import BeautifulSoup

import sys

sys.path.append('../')

from Config import opgg_config
from LOL.heroClass import HeroClass, OPSITIONEnum
from LOL.lolMongoClient import save_to_mongo, save_rank
from SpiderUtil.logUtil import Logger

log = Logger('../Log/opggSpider.log', level='debug')

headers = {
    'Accept':
    'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
    'Accept-Encoding':
    'gzip, deflate',
    'Accept-Language':
    'zh-CN,zh;q=0.9',
    'Cache-Control':
    'max-age=0',
    'Connection':
    'keep-alive',
    'Host':
    'www.op.gg',
    'Upgrade-Insecure-Requests':