Commit 5778036d authored by wang's avatar wang

f9

parent fff00571
......@@ -3,7 +3,9 @@ import {bl, genUuid, ht, ie, Ol, randint, se} from "./utils.js"
import axios from "axios";
import {PxEnv} from './px.js'
import {MongoClient} from "mongodb";
import * as fs from "fs";
let ENVS = JSON.parse(fs.readFileSync('./env.json', 'utf-8').toString())
let keys = Object.keys(ENVS);
const uri = "mongodb://lcc-spider:JIUsfhiad&^@54.183.159.9:27017/?authSource=admin&directConnection=true";
const client = new MongoClient(uri);
log4js.levels.INFO.colour = 'white';
......@@ -95,21 +97,21 @@ class PxBypass {
async initMongo() {
this.log.info("init mongo 获取环境数据")
const database = client.db("env");
const movies = database.collection("env_shape");
// Query for a movie that has the title 'The Room'
const query = {
'env.funcs': {$ne: null},
};
// Execute query
const movie = await movies.aggregate([
{$match: query},
{$sample: {size: 1}}
])
let res = await movie.toArray()
this.env = res[0].env
// const database = client.db("env");
// const movies = database.collection("env_shape");
// // Query for a movie that has the title 'The Room'
// const query = {
// 'env.funcs': {$ne: null},
// };
//
// // Execute query
// const movie = await movies.aggregate([
// {$match: query},
// {$sample: {size: 1}}
// ])
// let res = await movie.toArray()
// this.env = res[0].env
this.env = ENVS[keys[randint(0, keys.length - 1)]]
this.ua = this.env.navigatorparams.useragent
this.log.info('ua', this.ua)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment