Puppeteer + Playwright

This commit is contained in:
2024-05-29 16:42:52 +02:00
parent fe9a8e2b20
commit d38817f4c5
22 changed files with 1913 additions and 284 deletions
+220 -118
View File
@@ -1,6 +1,5 @@
// Interencheres.js
'use strict';
const { platform } = require('os');
const {Scraper} = require('../Scraper');
const DrouotData = require('./DrouotData');
@@ -24,6 +23,8 @@ class Drouot extends Scraper {
this._USER = "jp.ranu@cogip.de"
this._PWD = "LYPYRKDUsSMH5BaWQxvH#"
this._PATH_SESSION_FILE = ".session/session_drouot.json"
this._PATH_PROTOBUF_FILE = "./AuctionServices/Scraper/Drouot/drouot.proto"
this._BROWSER_TOOL = "playwrightBrowser"
}
getPictures = async ({ page, data}) => {
@@ -159,55 +160,79 @@ class Drouot extends Scraper {
return LotList
}
async CheckAndConnect(page) {
// ### Playwright
// ###########################################################################
async CheckCookieDialog(page) {
console.log("-- CheckCookieDialog --")
return new Promise(async (resolve, reject) => {
//let XpathCookieButton = "xpath=//button[contains(@class, 'rgpd') and contains(text(), 'Tout refuser')"
// const CookieButton = await page.$$(XpathCookieButton);
const CookieButton = await page.$('//button[contains(@class, "rgpd") and contains(text(), "Tout refuser")]');
//console.log(CookieButton)
if (CookieButton && await CookieButton.isVisible()) {
console.log("-- Click on CookieButton --")
await CookieButton.click();
}
resolve(true)
})
}
async CheckAndConnect(page) {
return new Promise(async (resolve, reject) => {
await page.goto(this._PAGE_MAIN);
await this.CheckCookieDialog(page);
console.log("-- CheckConnexion --")
//get the Connexion button
const [Connexion] = await page.$x("//div[contains(@class, 'btn') and contains(@class, 'ghost') and contains(text(), 'Connexion')]");
console.log(Connexion)
let XpathConnexion = "//div[contains(@class, 'btn') and contains(@class, 'ghost') and contains(text(), 'Connexion')]"
const Connexion = await page.$$(XpathConnexion);
// if Connection button found => Login
if (Connexion) {
if (Connexion.length > 0) {
console.log("-- Login --")
await page.goto(this._PAGE_LOGIN);
//get the Email field
//console.log("-- get Email Input --")
await page.type('#email', this._USER);
//await page.type('#email', this._USER);
await page.fill('#email', this._USER);
//console.log("-- get password Input --")
await page.type("#password", this._PWD);
//wait page.type("#password", this._PWD);
await page.fill('#password', this._PWD);
//await page.screenshot({ path: 'screenshot.png', fullPage: true });
//console.log("-- get ConnexionButton --")
const [ConnexionButton] = await page.$x("//button[contains(text(), 'Connexion')]");
await ConnexionButton.evaluate(b => b.click());
//const [ConnexionButton] = await page.$x("//button[contains(text(), 'Connexion')]");
//await ConnexionButton.evaluate(b => b.click());
await page.click("//button[contains(text(), 'Connexion')]");
//console.log("-- Login wait --")
await page.waitForTimeout(1000);
//resolve(page)
const ConnexionOK = await page.$$("//button[contains(text(), 'Continuer en tant que')]");
//console.log(ConnexionOK)
if (ConnexionOK.length > 0) {
//await ConnexionOK.screenshot({ path: 'screenshot.png', fullPage: true });
const [ConnexionOK] = await page.$x("//button[contains(text(), 'Continuer en tant que')]");
if (ConnexionOK) {
console.log("-- Connection OK --")
await ConnexionOK.evaluate(b => b.click());
//await ConnexionOK.evaluate(b => b.click());
await ConnexionOK[0].click();
await page.waitForTimeout(1000);
await this._saveSession(page)
// const sessionData = await page.session.dumpString({
// storageProviders: [
// StorageProviderName.Cookie,
// StorageProviderName.LocalStorage,
// StorageProviderName.SessionStorage,
// StorageProviderName.IndexedDB,
// ],
// })
// fs.writeFileSync(this._PATH_SESSION_FILE, sessionData);
// console.log("-- Connection OK --")
console.log("-- Connection OK --")
resolve(page)
} else {
console.error("-- !!!! Connection ERROR !!!! --");
@@ -224,111 +249,188 @@ class Drouot extends Scraper {
}
Live = async (browser) => {
const context = await this._getContext(browser);
console.log("Live "+this._Name+": "+this.Url)
let page = await context.newPage();
const page = await browser.newPage();
page = await this.CheckAndConnect(page);
let CheckAskStop = null;
let Socket = null;
const StopLive = async (params) => {
clearInterval(CheckAskStop);
Socket.off('Network.webSocketFrameReceived', listener);
page.close()
}
const listener = async (params) => {
let payload = params.response.payloadData
if(payload.length>1 && payload.substring(0, 2) == '42'){
payload = JSON.parse(payload.substring(2))
//console.log(payload)
const type = payload[0];
const payloadData = payload[1];
//init Protobuf Decoder
const protobuf = require("protobufjs");
const root = await protobuf.load(this._PATH_PROTOBUF_FILE);
const LiveBiddingMessage = root.lookupType("drouot.LiveBiddingMessage");
switch (type) {
const listener = async (params) => {
let buffer = params.payload;
case 'startSale':
break;
case 'listAuctionedItems':
break;
case 'joinedSale':
await this.JucunduNextItem(
payloadData.sale_id,
payloadData.timestamp,
payloadData.item_id,
payloadData.order_number.primary,
payloadData.title,
payloadData.description,
payloadData.pricing.estimates.min,
payloadData.pricing.estimates.max,
payloadData
);
break;
case 'auctionedItem':
await this.JucunduAuctionedItem(
payloadData.item_id,
payloadData.timestamp,
payloadData.auctioned.amount,
payloadData.auctioned.sold,
payloadData.auctioned.type
);
break;
case 'nextItem':
await this.JucunduNextItem(
payloadData.sale_id,
payloadData.timestamp,
payloadData.item_id,
payloadData.order_number.primary,
payloadData.title,
payloadData.description,
payloadData.pricing.estimates.min,
payloadData.pricing.estimates.max,
payloadData
);
break;
case 'bid':
await this.JucundusBid(
payloadData.item_id,
payloadData.timestamp,
payloadData.amount,
payloadData.auctioned_type
);
break;
case 'pauseSale':
console.error('** Pause **');
console.log(payloadData);
// await this.JucundusEndSale()
// StopLive()
break;
case 'endSale':
// await this.JucundusEndSale()
// StopLive()
break;
default:
console.error('Unknown data type:', type);
console.log(payloadData);
}
const err = LiveBiddingMessage.verify(buffer);
if (err) {
throw err;
}
const message = LiveBiddingMessage.decode(buffer);
const BideMessage = LiveBiddingMessage.toObject(message, {enums: String});
let DataLot = null
if(BideMessage.vente && BideMessage.vente.lot && BideMessage.vente.lot.lotId != undefined){
DataLot = await this.platformData.getLiveDataLot(BideMessage.vente.lot.lotId);
}
//console.log('BideMessage Type: '+BideMessage.type+' Lot: '+BideMessage.vente.lot.lotId);
switch (BideMessage.type) {
case 'PING':
break;
case 'PONG':
break;
case 'INIT':
console.log('INIT');
break;
case 'CLOSE':
console.log('CLOSE');
break;
case 'BID':
console.log('BID');
console.log('Lot: '+BideMessage.vente.lot.lotId+' Amount: '+BideMessage.vente.bid.amount);
await this.JucundusBid(
BideMessage.vente.lot.lotId,
Date.now(),
BideMessage.vente.bid.amount,
BideMessage.vente.bid.type
);
break;
case 'SELECT_LOT':
console.log('SELECT_LOT');
console.log('Lot: '+BideMessage.vente.lot.lotId);
//console.log('DataLot : '+DataLot)
await this.JucunduNextItem(
BideMessage.vente.venteId,
Date.now(),
BideMessage.vente.lot.lotId,
DataLot.num,
DataLot.titre,
DataLot.description,
DataLot.estimationBasse,
DataLot.estimationHaute,
DataLot
);
break;
case 'STARTING_PRICE':
console.log('STARTING_PRICE');
await this.JucunduNextItem(
BideMessage.vente.venteId,
Date.now(),
BideMessage.vente.lot.lotId,
DataLot.num,
DataLot.titre,
DataLot.description,
DataLot.estimationBasse,
DataLot.estimationHaute,
DataLot
);
break;
case 'INCREMENT':
console.log('INCREMENT');
break;
case 'TENDERING':
console.log('TENDERING');
console.log('Lot: '+BideMessage.vente.lot.lotId+' Amount: '+BideMessage.vente.bid.amount);
await this.JucunduAuctionedItem(
BideMessage.vente.lot.lotId,
Date.now(),
BideMessage.vente.bid.amount,
BideMessage.vente.lot.state == 'ADJ' ? true : false,
BideMessage.vente.bid.type
);
break;
case 'GENERIC_MESSAGE':
console.log('GENERIC_MESSAGE');
break;
case 'CREATE_LOT':
console.log('CREATE_LOT');
break;
case 'NOT_INTERESTED':
break;
case 'INTERESTED':
break;
case 'ACTIVITY':
break;
case 'NEW_CLIENT':
console.log('NEW_CLIENT');
break;
case 'CLOSED_CLIENT':
break;
case 'KILL':
break;
case 'MULTILOT_REQUEST':
break;
case 'MULTILOT_RESPONSE':
break;
case 'SYNC_PAYMENT_LIMIT':
break;
case 'SWITCH_FREE_BID_AUTHORIZE':
break;
case 'REFRESH_CLIENTS_COUNT':
console.log('REFRESH_CLIENTS_COUNT');
break;
default:
//console.log('Unknown type:', BideMessage);
}
};
try{
await page.goto(this.Url);
Socket = await page.target().createCDPSession();
await Socket.send('Network.enable');
await Socket.send('Page.enable');
Socket.on('Network.webSocketFrameReceived', listener);
console.log('Listener set up for Network.webSocketFrameReceived event');
// create the live URL
let {saleID} = await this.platformData.getUrlInfo(this.Url);
let UrlLive = this._PAGE_MAIN + "live/bidlive/" + saleID;
let CheckAskStop = null;
let Socket = null;
// Stop the Live
const StopLive = async (params) => {
clearInterval(CheckAskStop);
page.close()
browser.close()
}
try{
console.log('UrlLive : '+UrlLive)
await page.goto(UrlLive, { waitUntil: 'domcontentloaded' });
// intercept Lots Data
await page.route('https://api.drouot.com/drouot/gingolem/api/live/venteInfos/'+saleID+'?lang=fr', async route => {
console.log('GetLiveData')
const response = await route.fetch();
const LotData = await response.json();
this.platformData.setLiveData(LotData.data);
route.continue();
});
page.on('websocket', ws => {
Socket = ws;
Socket.on('framereceived', listener);
console.log('Websocket connected');
});
console.log('UrlLive : reload')
await page.reload();
// check if stop was asked
CheckAskStop = setInterval(async () => {
this.JucundusCheckStop()
+18 -2
View File
@@ -5,10 +5,12 @@ const moment = require('moment-timezone');
const { Console } = require('console');
const { title } = require('process');
class InterencheresData extends ScraperTools {
class DrouotData extends ScraperTools {
_Name = 'drouot'
_LiveData = null
getUrlInfo = async (url) => {
// URL Lot : https://drouot.com/fr/l/25184163-john-conde-17651794-britanniqu
@@ -373,6 +375,20 @@ class InterencheresData extends ScraperTools {
return SaleHouseName.trim()
}
// ## Live Data
setLiveData = (Data) => {
this._LiveData = Data
}
getLiveDataLot = async(lotId) => {
for (let lot of this._LiveData.lots) {
if (lot.id === lotId) {
return lot;
}
}
}
}
module.exports = InterencheresData
module.exports = DrouotData
+139
View File
@@ -0,0 +1,139 @@
syntax = "proto3";
package drouot;
message BidStruct {
enum Type {
LIVE = 0;
ROOM = 1;
}
uint32 amount = 1;
uint32 currentBidder = 2;
Type type = 3;
bool hasPriority = 4;
bool isLate = 5;
bool isAuto = 6;
IncrementStruct increment = 7;
uint32 nextamount = 8;
uint32 nextsmallamount = 9;
uint32 nextmediumamount = 10;
uint32 nextbigamount = 11;
uint32 nextsmallvehicleamount = 12;
uint32 nextmediumvehicleamount = 13;
uint32 nextstandardamount = 14;
uint32 nextmodel10amount = 15;
}
message IncrementStruct {
enum Type {
FIXED = 0;
SMALL = 1;
MEDIUM = 2;
BIG = 3;
SMALL_VEHICLE = 4;
MEDIUM_VEHICLE = 5;
STANDARD = 6;
MODEL10 = 7;
CUSTOM = 8;
}
Type type = 1;
uint32 fixedvalue = 2;
IncrementData customincrement = 3;
}
message IncrementData {
repeated IncrementStep incrementarray = 1;
}
message IncrementStep {
uint32 startvalue = 1;
uint32 incrementvalue = 2;
bool specialstep = 3;
}
message ClientStruct {
enum Permission {
BIDDER = 0;
CYBER = 1;
SPECTATOR = 2;
}
enum Activity {
IDLE = 0;
ACTIVE = 1;
OVER = 2;
OUT = 3;
}
string sessionId = 1;
uint32 passeportId = 2;
string uuid = 3;
Permission permission = 4;
Activity activity = 5;
uint32 pingdelay = 6;
uint32 maxamount = 7;
bool hasnolimit = 8;
string token = 9;
string refreshtoken = 10;
}
message LiveBiddingMessage {
enum Type {
PING = 0;
PONG = 1;
INIT = 2;
CLOSE = 3;
BID = 4;
SELECT_LOT = 5;
STARTING_PRICE = 6;
INCREMENT = 7;
TENDERING = 8;
GENERIC_MESSAGE = 9;
CREATE_LOT = 10;
NOT_INTERESTED = 11;
INTERESTED = 12;
ACTIVITY = 13;
NEW_CLIENT = 14;
CLOSED_CLIENT = 15;
KILL = 16;
MULTILOT_REQUEST = 17;
MULTILOT_RESPONSE = 18;
SYNC_PAYMENT_LIMIT = 19;
SWITCH_FREE_BID_AUTHORIZE = 20;
REFRESH_CLIENTS_COUNT = 21;
}
Type type = 1;
ClientStruct client = 2;
VenteStruct vente = 3;
string message = 4;
map<string, string> paramsMap = 5;
int64 pingtime = 6;
}
message LotStruct {
enum State {
NEW = 0;
MAP = 1;
BIDDING = 2;
ADJ = 3;
ADJ_CANCELED = 4;
}
uint32 lotId = 1;
State state = 2;
uint32 nextLotId = 3;
}
message VenteStruct {
uint32 venteId = 1;
BidStruct bid = 2;
LotStruct lot = 3;
repeated uint32 connectedRegisteredListList = 4;
repeated uint32 connectedSpectatorListList = 5;
repeated uint32 connectedCyberclercListList = 6;
bool isfreebidauthorized = 7;
uint32 connectedbiddercount = 8;
uint32 connectedspectatorcount = 9;
uint32 readytobidcount = 10;
}
@@ -1,6 +1,6 @@
// Drouot.js
'use strict';
const {Scraper} = require('../Scraper');
const {Scraper} = require('../../Scraper');
class Drouot extends Scraper {
@@ -0,0 +1,989 @@
Ye.exportSymbol("proto.BidStruct", null, Ve),
Ye.exportSymbol("proto.BidStruct.Type", null, Ve),
Ye.exportSymbol("proto.ClientStruct", null, Ve),
Ye.exportSymbol("proto.ClientStruct.Activity", null, Ve),
Ye.exportSymbol("proto.ClientStruct.Permission", null, Ve),
Ye.exportSymbol("proto.IncrementData", null, Ve),
Ye.exportSymbol("proto.IncrementStep", null, Ve),
Ye.exportSymbol("proto.IncrementStruct", null, Ve),
Ye.exportSymbol("proto.IncrementStruct.Type", null, Ve),
Ye.exportSymbol("proto.LiveBiddingMessage", null, Ve),
Ye.exportSymbol("proto.LiveBiddingMessage.Type", null, Ve),
Ye.exportSymbol("proto.LotStruct", null, Ve),
Ye.exportSymbol("proto.LotStruct.State", null, Ve),
Ye.exportSymbol("proto.VenteStruct", null, Ve),
(proto.IncrementStep = function (Be) {
_e.Message.initialize(this, Be, 0, -1, null, null);
}),
Ye.inherits(proto.IncrementStep, _e.Message),
Ye.DEBUG && !COMPILED && (proto.IncrementStep.displayName = "proto.IncrementStep"),
(proto.IncrementData = function (Be) {
_e.Message.initialize(this, Be, 0, -1, proto.IncrementData.repeatedFields_, null);
}),
Ye.inherits(proto.IncrementData, _e.Message),
Ye.DEBUG && !COMPILED && (proto.IncrementData.displayName = "proto.IncrementData"),
(proto.IncrementStruct = function (Be) {
_e.Message.initialize(this, Be, 0, -1, null, null);
}),
Ye.inherits(proto.IncrementStruct, _e.Message),
Ye.DEBUG && !COMPILED && (proto.IncrementStruct.displayName = "proto.IncrementStruct"),
(proto.BidStruct = function (Be) {
_e.Message.initialize(this, Be, 0, -1, null, null);
}),
Ye.inherits(proto.BidStruct, _e.Message),
Ye.DEBUG && !COMPILED && (proto.BidStruct.displayName = "proto.BidStruct"),
(proto.LotStruct = function (Be) {
_e.Message.initialize(this, Be, 0, -1, null, null);
}),
Ye.inherits(proto.LotStruct, _e.Message),
Ye.DEBUG && !COMPILED && (proto.LotStruct.displayName = "proto.LotStruct"),
(proto.VenteStruct = function (Be) {
_e.Message.initialize(this, Be, 0, -1, proto.VenteStruct.repeatedFields_, null);
}),
Ye.inherits(proto.VenteStruct, _e.Message),
Ye.DEBUG && !COMPILED && (proto.VenteStruct.displayName = "proto.VenteStruct"),
(proto.ClientStruct = function (Be) {
_e.Message.initialize(this, Be, 0, -1, null, null);
}),
Ye.inherits(proto.ClientStruct, _e.Message),
Ye.DEBUG && !COMPILED && (proto.ClientStruct.displayName = "proto.ClientStruct"),
(proto.LiveBiddingMessage = function (Be) {
_e.Message.initialize(this, Be, 0, -1, null, null);
}),
Ye.inherits(proto.LiveBiddingMessage, _e.Message),
Ye.DEBUG && !COMPILED && (proto.LiveBiddingMessage.displayName = "proto.LiveBiddingMessage"),
_e.Message.GENERATE_TO_OBJECT &&
((proto.IncrementStep.prototype.toObject = function (Be) {
return proto.IncrementStep.toObject(Be, this);
}),
(proto.IncrementStep.toObject = function (Be, Re) {
var Ue = { startvalue: _e.Message.getFieldWithDefault(Re, 1, 0), incrementvalue: _e.Message.getFieldWithDefault(Re, 2, 0), specialstep: _e.Message.getBooleanFieldWithDefault(Re, 3, !1) };
return Be && (Ue.$jspbMessageInstance = Re), Ue;
})),
(proto.IncrementStep.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.IncrementStep();
return proto.IncrementStep.deserializeBinaryFromReader(Ue, Re);
}),
(proto.IncrementStep.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readUint32();
Be.setStartvalue(Ue);
break;
case 2:
Ue = Re.readUint32();
Be.setIncrementvalue(Ue);
break;
case 3:
Ue = Re.readBool();
Be.setSpecialstep(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.IncrementStep.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.IncrementStep.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.IncrementStep.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
0 !== (Ue = Be.getStartvalue()) && Re.writeUint32(1, Ue), 0 !== (Ue = Be.getIncrementvalue()) && Re.writeUint32(2, Ue), (Ue = Be.getSpecialstep()) && Re.writeBool(3, Ue);
}),
(proto.IncrementStep.prototype.getStartvalue = function () {
return _e.Message.getFieldWithDefault(this, 1, 0);
}),
(proto.IncrementStep.prototype.setStartvalue = function (Be) {
return _e.Message.setProto3IntField(this, 1, Be);
}),
(proto.IncrementStep.prototype.getIncrementvalue = function () {
return _e.Message.getFieldWithDefault(this, 2, 0);
}),
(proto.IncrementStep.prototype.setIncrementvalue = function (Be) {
return _e.Message.setProto3IntField(this, 2, Be);
}),
(proto.IncrementStep.prototype.getSpecialstep = function () {
return _e.Message.getBooleanFieldWithDefault(this, 3, !1);
}),
(proto.IncrementStep.prototype.setSpecialstep = function (Be) {
return _e.Message.setProto3BooleanField(this, 3, Be);
}),
(proto.IncrementData.repeatedFields_ = [1]),
_e.Message.GENERATE_TO_OBJECT &&
((proto.IncrementData.prototype.toObject = function (Be) {
return proto.IncrementData.toObject(Be, this);
}),
(proto.IncrementData.toObject = function (Be, Re) {
var Ue = { incrementarrayList: _e.Message.toObjectList(Re.getIncrementarrayList(), proto.IncrementStep.toObject, Be) };
return Be && (Ue.$jspbMessageInstance = Re), Ue;
})),
(proto.IncrementData.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.IncrementData();
return proto.IncrementData.deserializeBinaryFromReader(Ue, Re);
}),
(proto.IncrementData.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = new proto.IncrementStep();
Re.readMessage(Ue, proto.IncrementStep.deserializeBinaryFromReader), Be.addIncrementarray(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.IncrementData.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.IncrementData.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.IncrementData.serializeBinaryToWriter = function (Be, Re) {
var Ue;
(Ue = Be.getIncrementarrayList()).length > 0 && Re.writeRepeatedMessage(1, Ue, proto.IncrementStep.serializeBinaryToWriter);
}),
(proto.IncrementData.prototype.getIncrementarrayList = function () {
return _e.Message.getRepeatedWrapperField(this, proto.IncrementStep, 1);
}),
(proto.IncrementData.prototype.setIncrementarrayList = function (Be) {
return _e.Message.setRepeatedWrapperField(this, 1, Be);
}),
(proto.IncrementData.prototype.addIncrementarray = function (Be, Re) {
return _e.Message.addToRepeatedWrapperField(this, 1, Be, proto.IncrementStep, Re);
}),
(proto.IncrementData.prototype.clearIncrementarrayList = function () {
return this.setIncrementarrayList([]);
}),
_e.Message.GENERATE_TO_OBJECT &&
((proto.IncrementStruct.prototype.toObject = function (Be) {
return proto.IncrementStruct.toObject(Be, this);
}),
(proto.IncrementStruct.toObject = function (Be, Re) {
var Ue,
Ye = { type: _e.Message.getFieldWithDefault(Re, 1, 0), fixedvalue: _e.Message.getFieldWithDefault(Re, 2, 0), customincrement: (Ue = Re.getCustomincrement()) && proto.IncrementData.toObject(Be, Ue) };
return Be && (Ye.$jspbMessageInstance = Re), Ye;
})),
(proto.IncrementStruct.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.IncrementStruct();
return proto.IncrementStruct.deserializeBinaryFromReader(Ue, Re);
}),
(proto.IncrementStruct.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readEnum();
Be.setType(Ue);
break;
case 2:
Ue = Re.readUint32();
Be.setFixedvalue(Ue);
break;
case 3:
Ue = new proto.IncrementData();
Re.readMessage(Ue, proto.IncrementData.deserializeBinaryFromReader), Be.setCustomincrement(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.IncrementStruct.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.IncrementStruct.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.IncrementStruct.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
0 !== (Ue = Be.getType()) && Re.writeEnum(1, Ue), 0 !== (Ue = Be.getFixedvalue()) && Re.writeUint32(2, Ue), null != (Ue = Be.getCustomincrement()) && Re.writeMessage(3, Ue, proto.IncrementData.serializeBinaryToWriter);
}),
(proto.IncrementStruct.Type = { FIXED: 0, SMALL: 1, MEDIUM: 2, BIG: 3, SMALL_VEHICLE: 4, MEDIUM_VEHICLE: 5, STANDARD: 6, MODEL10: 7, CUSTOM: 8 }),
(proto.IncrementStruct.prototype.getType = function () {
return _e.Message.getFieldWithDefault(this, 1, 0);
}),
(proto.IncrementStruct.prototype.setType = function (Be) {
return _e.Message.setProto3EnumField(this, 1, Be);
}),
(proto.IncrementStruct.prototype.getFixedvalue = function () {
return _e.Message.getFieldWithDefault(this, 2, 0);
}),
(proto.IncrementStruct.prototype.setFixedvalue = function (Be) {
return _e.Message.setProto3IntField(this, 2, Be);
}),
(proto.IncrementStruct.prototype.getCustomincrement = function () {
return _e.Message.getWrapperField(this, proto.IncrementData, 3);
}),
(proto.IncrementStruct.prototype.setCustomincrement = function (Be) {
return _e.Message.setWrapperField(this, 3, Be);
}),
(proto.IncrementStruct.prototype.clearCustomincrement = function () {
return this.setCustomincrement(void 0);
}),
(proto.IncrementStruct.prototype.hasCustomincrement = function () {
return null != _e.Message.getField(this, 3);
}),
_e.Message.GENERATE_TO_OBJECT &&
((proto.BidStruct.prototype.toObject = function (Be) {
return proto.BidStruct.toObject(Be, this);
}),
(proto.BidStruct.toObject = function (Be, Re) {
var Ue,
Ye = {
amount: _e.Message.getFieldWithDefault(Re, 1, 0),
currentBidder: _e.Message.getFieldWithDefault(Re, 2, 0),
type: _e.Message.getFieldWithDefault(Re, 3, 0),
hasPriority: _e.Message.getBooleanFieldWithDefault(Re, 4, !1),
isLate: _e.Message.getBooleanFieldWithDefault(Re, 5, !1),
isAuto: _e.Message.getBooleanFieldWithDefault(Re, 6, !1),
increment: (Ue = Re.getIncrement()) && proto.IncrementStruct.toObject(Be, Ue),
nextamount: _e.Message.getFieldWithDefault(Re, 8, 0),
nextsmallamount: _e.Message.getFieldWithDefault(Re, 9, 0),
nextmediumamount: _e.Message.getFieldWithDefault(Re, 10, 0),
nextbigamount: _e.Message.getFieldWithDefault(Re, 11, 0),
nextsmallvehicleamount: _e.Message.getFieldWithDefault(Re, 12, 0),
nextmediumvehicleamount: _e.Message.getFieldWithDefault(Re, 13, 0),
nextstandardamount: _e.Message.getFieldWithDefault(Re, 14, 0),
nextmodel10amount: _e.Message.getFieldWithDefault(Re, 15, 0),
};
return Be && (Ye.$jspbMessageInstance = Re), Ye;
})),
(proto.BidStruct.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.BidStruct();
return proto.BidStruct.deserializeBinaryFromReader(Ue, Re);
}),
(proto.BidStruct.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readUint32();
Be.setAmount(Ue);
break;
case 2:
Ue = Re.readUint32();
Be.setCurrentBidder(Ue);
break;
case 3:
Ue = Re.readEnum();
Be.setType(Ue);
break;
case 4:
Ue = Re.readBool();
Be.setHasPriority(Ue);
break;
case 5:
Ue = Re.readBool();
Be.setIsLate(Ue);
break;
case 6:
Ue = Re.readBool();
Be.setIsAuto(Ue);
break;
case 7:
Ue = new proto.IncrementStruct();
Re.readMessage(Ue, proto.IncrementStruct.deserializeBinaryFromReader), Be.setIncrement(Ue);
break;
case 8:
Ue = Re.readUint32();
Be.setNextamount(Ue);
break;
case 9:
Ue = Re.readUint32();
Be.setNextsmallamount(Ue);
break;
case 10:
Ue = Re.readUint32();
Be.setNextmediumamount(Ue);
break;
case 11:
Ue = Re.readUint32();
Be.setNextbigamount(Ue);
break;
case 12:
Ue = Re.readUint32();
Be.setNextsmallvehicleamount(Ue);
break;
case 13:
Ue = Re.readUint32();
Be.setNextmediumvehicleamount(Ue);
break;
case 14:
Ue = Re.readUint32();
Be.setNextstandardamount(Ue);
break;
case 15:
Ue = Re.readUint32();
Be.setNextmodel10amount(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.BidStruct.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.BidStruct.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.BidStruct.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
0 !== (Ue = Be.getAmount()) && Re.writeUint32(1, Ue),
0 !== (Ue = Be.getCurrentBidder()) && Re.writeUint32(2, Ue),
0 !== (Ue = Be.getType()) && Re.writeEnum(3, Ue),
(Ue = Be.getHasPriority()) && Re.writeBool(4, Ue),
(Ue = Be.getIsLate()) && Re.writeBool(5, Ue),
(Ue = Be.getIsAuto()) && Re.writeBool(6, Ue),
null != (Ue = Be.getIncrement()) && Re.writeMessage(7, Ue, proto.IncrementStruct.serializeBinaryToWriter),
0 !== (Ue = Be.getNextamount()) && Re.writeUint32(8, Ue),
0 !== (Ue = Be.getNextsmallamount()) && Re.writeUint32(9, Ue),
0 !== (Ue = Be.getNextmediumamount()) && Re.writeUint32(10, Ue),
0 !== (Ue = Be.getNextbigamount()) && Re.writeUint32(11, Ue),
0 !== (Ue = Be.getNextsmallvehicleamount()) && Re.writeUint32(12, Ue),
0 !== (Ue = Be.getNextmediumvehicleamount()) && Re.writeUint32(13, Ue),
0 !== (Ue = Be.getNextstandardamount()) && Re.writeUint32(14, Ue),
0 !== (Ue = Be.getNextmodel10amount()) && Re.writeUint32(15, Ue);
}),
(proto.BidStruct.Type = { LIVE: 0, ROOM: 1 }),
(proto.BidStruct.prototype.getAmount = function () {
return _e.Message.getFieldWithDefault(this, 1, 0);
}),
(proto.BidStruct.prototype.setAmount = function (Be) {
return _e.Message.setProto3IntField(this, 1, Be);
}),
(proto.BidStruct.prototype.getCurrentBidder = function () {
return _e.Message.getFieldWithDefault(this, 2, 0);
}),
(proto.BidStruct.prototype.setCurrentBidder = function (Be) {
return _e.Message.setProto3IntField(this, 2, Be);
}),
(proto.BidStruct.prototype.getType = function () {
return _e.Message.getFieldWithDefault(this, 3, 0);
}),
(proto.BidStruct.prototype.setType = function (Be) {
return _e.Message.setProto3EnumField(this, 3, Be);
}),
(proto.BidStruct.prototype.getHasPriority = function () {
return _e.Message.getBooleanFieldWithDefault(this, 4, !1);
}),
(proto.BidStruct.prototype.setHasPriority = function (Be) {
return _e.Message.setProto3BooleanField(this, 4, Be);
}),
(proto.BidStruct.prototype.getIsLate = function () {
return _e.Message.getBooleanFieldWithDefault(this, 5, !1);
}),
(proto.BidStruct.prototype.setIsLate = function (Be) {
return _e.Message.setProto3BooleanField(this, 5, Be);
}),
(proto.BidStruct.prototype.getIsAuto = function () {
return _e.Message.getBooleanFieldWithDefault(this, 6, !1);
}),
(proto.BidStruct.prototype.setIsAuto = function (Be) {
return _e.Message.setProto3BooleanField(this, 6, Be);
}),
(proto.BidStruct.prototype.getIncrement = function () {
return _e.Message.getWrapperField(this, proto.IncrementStruct, 7);
}),
(proto.BidStruct.prototype.setIncrement = function (Be) {
return _e.Message.setWrapperField(this, 7, Be);
}),
(proto.BidStruct.prototype.clearIncrement = function () {
return this.setIncrement(void 0);
}),
(proto.BidStruct.prototype.hasIncrement = function () {
return null != _e.Message.getField(this, 7);
}),
(proto.BidStruct.prototype.getNextamount = function () {
return _e.Message.getFieldWithDefault(this, 8, 0);
}),
(proto.BidStruct.prototype.setNextamount = function (Be) {
return _e.Message.setProto3IntField(this, 8, Be);
}),
(proto.BidStruct.prototype.getNextsmallamount = function () {
return _e.Message.getFieldWithDefault(this, 9, 0);
}),
(proto.BidStruct.prototype.setNextsmallamount = function (Be) {
return _e.Message.setProto3IntField(this, 9, Be);
}),
(proto.BidStruct.prototype.getNextmediumamount = function () {
return _e.Message.getFieldWithDefault(this, 10, 0);
}),
(proto.BidStruct.prototype.setNextmediumamount = function (Be) {
return _e.Message.setProto3IntField(this, 10, Be);
}),
(proto.BidStruct.prototype.getNextbigamount = function () {
return _e.Message.getFieldWithDefault(this, 11, 0);
}),
(proto.BidStruct.prototype.setNextbigamount = function (Be) {
return _e.Message.setProto3IntField(this, 11, Be);
}),
(proto.BidStruct.prototype.getNextsmallvehicleamount = function () {
return _e.Message.getFieldWithDefault(this, 12, 0);
}),
(proto.BidStruct.prototype.setNextsmallvehicleamount = function (Be) {
return _e.Message.setProto3IntField(this, 12, Be);
}),
(proto.BidStruct.prototype.getNextmediumvehicleamount = function () {
return _e.Message.getFieldWithDefault(this, 13, 0);
}),
(proto.BidStruct.prototype.setNextmediumvehicleamount = function (Be) {
return _e.Message.setProto3IntField(this, 13, Be);
}),
(proto.BidStruct.prototype.getNextstandardamount = function () {
return _e.Message.getFieldWithDefault(this, 14, 0);
}),
(proto.BidStruct.prototype.setNextstandardamount = function (Be) {
return _e.Message.setProto3IntField(this, 14, Be);
}),
(proto.BidStruct.prototype.getNextmodel10amount = function () {
return _e.Message.getFieldWithDefault(this, 15, 0);
}),
(proto.BidStruct.prototype.setNextmodel10amount = function (Be) {
return _e.Message.setProto3IntField(this, 15, Be);
}),
_e.Message.GENERATE_TO_OBJECT &&
((proto.LotStruct.prototype.toObject = function (Be) {
return proto.LotStruct.toObject(Be, this);
}),
(proto.LotStruct.toObject = function (Be, Re) {
var Ue = { lotId: _e.Message.getFieldWithDefault(Re, 1, 0), state: _e.Message.getFieldWithDefault(Re, 2, 0), nextLotId: _e.Message.getFieldWithDefault(Re, 3, 0) };
return Be && (Ue.$jspbMessageInstance = Re), Ue;
})),
(proto.LotStruct.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.LotStruct();
return proto.LotStruct.deserializeBinaryFromReader(Ue, Re);
}),
(proto.LotStruct.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readUint32();
Be.setLotId(Ue);
break;
case 2:
Ue = Re.readEnum();
Be.setState(Ue);
break;
case 3:
Ue = Re.readUint32();
Be.setNextLotId(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.LotStruct.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.LotStruct.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.LotStruct.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
0 !== (Ue = Be.getLotId()) && Re.writeUint32(1, Ue), 0 !== (Ue = Be.getState()) && Re.writeEnum(2, Ue), 0 !== (Ue = Be.getNextLotId()) && Re.writeUint32(3, Ue);
}),
(proto.LotStruct.State = { NEW: 0, MAP: 1, BIDDING: 2, ADJ: 3, ADJ_CANCELED: 4 }),
(proto.LotStruct.prototype.getLotId = function () {
return _e.Message.getFieldWithDefault(this, 1, 0);
}),
(proto.LotStruct.prototype.setLotId = function (Be) {
return _e.Message.setProto3IntField(this, 1, Be);
}),
(proto.LotStruct.prototype.getState = function () {
return _e.Message.getFieldWithDefault(this, 2, 0);
}),
(proto.LotStruct.prototype.setState = function (Be) {
return _e.Message.setProto3EnumField(this, 2, Be);
}),
(proto.LotStruct.prototype.getNextLotId = function () {
return _e.Message.getFieldWithDefault(this, 3, 0);
}),
(proto.LotStruct.prototype.setNextLotId = function (Be) {
return _e.Message.setProto3IntField(this, 3, Be);
}),
(proto.VenteStruct.repeatedFields_ = [4, 5, 6]),
_e.Message.GENERATE_TO_OBJECT &&
((proto.VenteStruct.prototype.toObject = function (Be) {
return proto.VenteStruct.toObject(Be, this);
}),
(proto.VenteStruct.toObject = function (Be, Re) {
var Ue,
Ye = {
venteId: _e.Message.getFieldWithDefault(Re, 1, 0),
bid: (Ue = Re.getBid()) && proto.BidStruct.toObject(Be, Ue),
lot: (Ue = Re.getLot()) && proto.LotStruct.toObject(Be, Ue),
connectedRegisteredListList: null == (Ue = _e.Message.getRepeatedField(Re, 4)) ? void 0 : Ue,
connectedSpectatorListList: null == (Ue = _e.Message.getRepeatedField(Re, 5)) ? void 0 : Ue,
connectedCyberclercListList: null == (Ue = _e.Message.getRepeatedField(Re, 6)) ? void 0 : Ue,
isfreebidauthorized: _e.Message.getBooleanFieldWithDefault(Re, 7, !1),
connectedbiddercount: _e.Message.getFieldWithDefault(Re, 8, 0),
connectedspectatorcount: _e.Message.getFieldWithDefault(Re, 9, 0),
readytobidcount: _e.Message.getFieldWithDefault(Re, 10, 0),
};
return Be && (Ye.$jspbMessageInstance = Re), Ye;
})),
(proto.VenteStruct.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.VenteStruct();
return proto.VenteStruct.deserializeBinaryFromReader(Ue, Re);
}),
(proto.VenteStruct.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readUint32();
Be.setVenteId(Ue);
break;
case 2:
Ue = new proto.BidStruct();
Re.readMessage(Ue, proto.BidStruct.deserializeBinaryFromReader), Be.setBid(Ue);
break;
case 3:
Ue = new proto.LotStruct();
Re.readMessage(Ue, proto.LotStruct.deserializeBinaryFromReader), Be.setLot(Ue);
break;
case 4:
for (var _e = Re.isDelimited() ? Re.readPackedUint32() : [Re.readUint32()], Ye = 0; Ye < _e.length; Ye++) Be.addConnectedRegisteredList(_e[Ye]);
break;
case 5:
for (_e = Re.isDelimited() ? Re.readPackedUint32() : [Re.readUint32()], Ye = 0; Ye < _e.length; Ye++) Be.addConnectedSpectatorList(_e[Ye]);
break;
case 6:
for (_e = Re.isDelimited() ? Re.readPackedUint32() : [Re.readUint32()], Ye = 0; Ye < _e.length; Ye++) Be.addConnectedCyberclercList(_e[Ye]);
break;
case 7:
Ue = Re.readBool();
Be.setIsfreebidauthorized(Ue);
break;
case 8:
Ue = Re.readUint32();
Be.setConnectedbiddercount(Ue);
break;
case 9:
Ue = Re.readUint32();
Be.setConnectedspectatorcount(Ue);
break;
case 10:
Ue = Re.readUint32();
Be.setReadytobidcount(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.VenteStruct.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.VenteStruct.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.VenteStruct.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
0 !== (Ue = Be.getVenteId()) && Re.writeUint32(1, Ue),
null != (Ue = Be.getBid()) && Re.writeMessage(2, Ue, proto.BidStruct.serializeBinaryToWriter),
null != (Ue = Be.getLot()) && Re.writeMessage(3, Ue, proto.LotStruct.serializeBinaryToWriter),
(Ue = Be.getConnectedRegisteredListList()).length > 0 && Re.writePackedUint32(4, Ue),
(Ue = Be.getConnectedSpectatorListList()).length > 0 && Re.writePackedUint32(5, Ue),
(Ue = Be.getConnectedCyberclercListList()).length > 0 && Re.writePackedUint32(6, Ue),
(Ue = Be.getIsfreebidauthorized()) && Re.writeBool(7, Ue),
0 !== (Ue = Be.getConnectedbiddercount()) && Re.writeUint32(8, Ue),
0 !== (Ue = Be.getConnectedspectatorcount()) && Re.writeUint32(9, Ue),
0 !== (Ue = Be.getReadytobidcount()) && Re.writeUint32(10, Ue);
}),
(proto.VenteStruct.prototype.getVenteId = function () {
return _e.Message.getFieldWithDefault(this, 1, 0);
}),
(proto.VenteStruct.prototype.setVenteId = function (Be) {
return _e.Message.setProto3IntField(this, 1, Be);
}),
(proto.VenteStruct.prototype.getBid = function () {
return _e.Message.getWrapperField(this, proto.BidStruct, 2);
}),
(proto.VenteStruct.prototype.setBid = function (Be) {
return _e.Message.setWrapperField(this, 2, Be);
}),
(proto.VenteStruct.prototype.clearBid = function () {
return this.setBid(void 0);
}),
(proto.VenteStruct.prototype.hasBid = function () {
return null != _e.Message.getField(this, 2);
}),
(proto.VenteStruct.prototype.getLot = function () {
return _e.Message.getWrapperField(this, proto.LotStruct, 3);
}),
(proto.VenteStruct.prototype.setLot = function (Be) {
return _e.Message.setWrapperField(this, 3, Be);
}),
(proto.VenteStruct.prototype.clearLot = function () {
return this.setLot(void 0);
}),
(proto.VenteStruct.prototype.hasLot = function () {
return null != _e.Message.getField(this, 3);
}),
(proto.VenteStruct.prototype.getConnectedRegisteredListList = function () {
return _e.Message.getRepeatedField(this, 4);
}),
(proto.VenteStruct.prototype.setConnectedRegisteredListList = function (Be) {
return _e.Message.setField(this, 4, Be || []);
}),
(proto.VenteStruct.prototype.addConnectedRegisteredList = function (Be, Re) {
return _e.Message.addToRepeatedField(this, 4, Be, Re);
}),
(proto.VenteStruct.prototype.clearConnectedRegisteredListList = function () {
return this.setConnectedRegisteredListList([]);
}),
(proto.VenteStruct.prototype.getConnectedSpectatorListList = function () {
return _e.Message.getRepeatedField(this, 5);
}),
(proto.VenteStruct.prototype.setConnectedSpectatorListList = function (Be) {
return _e.Message.setField(this, 5, Be || []);
}),
(proto.VenteStruct.prototype.addConnectedSpectatorList = function (Be, Re) {
return _e.Message.addToRepeatedField(this, 5, Be, Re);
}),
(proto.VenteStruct.prototype.clearConnectedSpectatorListList = function () {
return this.setConnectedSpectatorListList([]);
}),
(proto.VenteStruct.prototype.getConnectedCyberclercListList = function () {
return _e.Message.getRepeatedField(this, 6);
}),
(proto.VenteStruct.prototype.setConnectedCyberclercListList = function (Be) {
return _e.Message.setField(this, 6, Be || []);
}),
(proto.VenteStruct.prototype.addConnectedCyberclercList = function (Be, Re) {
return _e.Message.addToRepeatedField(this, 6, Be, Re);
}),
(proto.VenteStruct.prototype.clearConnectedCyberclercListList = function () {
return this.setConnectedCyberclercListList([]);
}),
(proto.VenteStruct.prototype.getIsfreebidauthorized = function () {
return _e.Message.getBooleanFieldWithDefault(this, 7, !1);
}),
(proto.VenteStruct.prototype.setIsfreebidauthorized = function (Be) {
return _e.Message.setProto3BooleanField(this, 7, Be);
}),
(proto.VenteStruct.prototype.getConnectedbiddercount = function () {
return _e.Message.getFieldWithDefault(this, 8, 0);
}),
(proto.VenteStruct.prototype.setConnectedbiddercount = function (Be) {
return _e.Message.setProto3IntField(this, 8, Be);
}),
(proto.VenteStruct.prototype.getConnectedspectatorcount = function () {
return _e.Message.getFieldWithDefault(this, 9, 0);
}),
(proto.VenteStruct.prototype.setConnectedspectatorcount = function (Be) {
return _e.Message.setProto3IntField(this, 9, Be);
}),
(proto.VenteStruct.prototype.getReadytobidcount = function () {
return _e.Message.getFieldWithDefault(this, 10, 0);
}),
(proto.VenteStruct.prototype.setReadytobidcount = function (Be) {
return _e.Message.setProto3IntField(this, 10, Be);
}),
_e.Message.GENERATE_TO_OBJECT &&
((proto.ClientStruct.prototype.toObject = function (Be) {
return proto.ClientStruct.toObject(Be, this);
}),
(proto.ClientStruct.toObject = function (Be, Re) {
var Ue = {
sessionId: _e.Message.getFieldWithDefault(Re, 1, ""),
passeportId: _e.Message.getFieldWithDefault(Re, 2, 0),
uuid: _e.Message.getFieldWithDefault(Re, 3, ""),
permission: _e.Message.getFieldWithDefault(Re, 4, 0),
activity: _e.Message.getFieldWithDefault(Re, 5, 0),
pingdelay: _e.Message.getFieldWithDefault(Re, 6, 0),
maxamount: _e.Message.getFieldWithDefault(Re, 7, 0),
hasnolimit: _e.Message.getBooleanFieldWithDefault(Re, 8, !1),
token: _e.Message.getFieldWithDefault(Re, 9, ""),
refreshtoken: _e.Message.getFieldWithDefault(Re, 10, ""),
};
return Be && (Ue.$jspbMessageInstance = Re), Ue;
})),
(proto.ClientStruct.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.ClientStruct();
return proto.ClientStruct.deserializeBinaryFromReader(Ue, Re);
}),
(proto.ClientStruct.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readString();
Be.setSessionId(Ue);
break;
case 2:
Ue = Re.readUint32();
Be.setPasseportId(Ue);
break;
case 3:
Ue = Re.readString();
Be.setUuid(Ue);
break;
case 4:
Ue = Re.readEnum();
Be.setPermission(Ue);
break;
case 5:
Ue = Re.readEnum();
Be.setActivity(Ue);
break;
case 6:
Ue = Re.readUint32();
Be.setPingdelay(Ue);
break;
case 7:
Ue = Re.readUint32();
Be.setMaxamount(Ue);
break;
case 8:
Ue = Re.readBool();
Be.setHasnolimit(Ue);
break;
case 9:
Ue = Re.readString();
Be.setToken(Ue);
break;
case 10:
Ue = Re.readString();
Be.setRefreshtoken(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.ClientStruct.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.ClientStruct.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.ClientStruct.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
(Ue = Be.getSessionId()).length > 0 && Re.writeString(1, Ue),
0 !== (Ue = Be.getPasseportId()) && Re.writeUint32(2, Ue),
(Ue = Be.getUuid()).length > 0 && Re.writeString(3, Ue),
0 !== (Ue = Be.getPermission()) && Re.writeEnum(4, Ue),
0 !== (Ue = Be.getActivity()) && Re.writeEnum(5, Ue),
0 !== (Ue = Be.getPingdelay()) && Re.writeUint32(6, Ue),
0 !== (Ue = Be.getMaxamount()) && Re.writeUint32(7, Ue),
(Ue = Be.getHasnolimit()) && Re.writeBool(8, Ue),
(Ue = Be.getToken()).length > 0 && Re.writeString(9, Ue),
(Ue = Be.getRefreshtoken()).length > 0 && Re.writeString(10, Ue);
}),
(proto.ClientStruct.Permission = { BIDDER: 0, CYBER: 1, SPECTATOR: 2 }),
(proto.ClientStruct.Activity = { IDLE: 0, ACTIVE: 1, OVER: 2, OUT: 3 }),
(proto.ClientStruct.prototype.getSessionId = function () {
return _e.Message.getFieldWithDefault(this, 1, "");
}),
(proto.ClientStruct.prototype.setSessionId = function (Be) {
return _e.Message.setProto3StringField(this, 1, Be);
}),
(proto.ClientStruct.prototype.getPasseportId = function () {
return _e.Message.getFieldWithDefault(this, 2, 0);
}),
(proto.ClientStruct.prototype.setPasseportId = function (Be) {
return _e.Message.setProto3IntField(this, 2, Be);
}),
(proto.ClientStruct.prototype.getUuid = function () {
return _e.Message.getFieldWithDefault(this, 3, "");
}),
(proto.ClientStruct.prototype.setUuid = function (Be) {
return _e.Message.setProto3StringField(this, 3, Be);
}),
(proto.ClientStruct.prototype.getPermission = function () {
return _e.Message.getFieldWithDefault(this, 4, 0);
}),
(proto.ClientStruct.prototype.setPermission = function (Be) {
return _e.Message.setProto3EnumField(this, 4, Be);
}),
(proto.ClientStruct.prototype.getActivity = function () {
return _e.Message.getFieldWithDefault(this, 5, 0);
}),
(proto.ClientStruct.prototype.setActivity = function (Be) {
return _e.Message.setProto3EnumField(this, 5, Be);
}),
(proto.ClientStruct.prototype.getPingdelay = function () {
return _e.Message.getFieldWithDefault(this, 6, 0);
}),
(proto.ClientStruct.prototype.setPingdelay = function (Be) {
return _e.Message.setProto3IntField(this, 6, Be);
}),
(proto.ClientStruct.prototype.getMaxamount = function () {
return _e.Message.getFieldWithDefault(this, 7, 0);
}),
(proto.ClientStruct.prototype.setMaxamount = function (Be) {
return _e.Message.setProto3IntField(this, 7, Be);
}),
(proto.ClientStruct.prototype.getHasnolimit = function () {
return _e.Message.getBooleanFieldWithDefault(this, 8, !1);
}),
(proto.ClientStruct.prototype.setHasnolimit = function (Be) {
return _e.Message.setProto3BooleanField(this, 8, Be);
}),
(proto.ClientStruct.prototype.getToken = function () {
return _e.Message.getFieldWithDefault(this, 9, "");
}),
(proto.ClientStruct.prototype.setToken = function (Be) {
return _e.Message.setProto3StringField(this, 9, Be);
}),
(proto.ClientStruct.prototype.getRefreshtoken = function () {
return _e.Message.getFieldWithDefault(this, 10, "");
}),
(proto.ClientStruct.prototype.setRefreshtoken = function (Be) {
return _e.Message.setProto3StringField(this, 10, Be);
}),
_e.Message.GENERATE_TO_OBJECT &&
((proto.LiveBiddingMessage.prototype.toObject = function (Be) {
return proto.LiveBiddingMessage.toObject(Be, this);
}),
(proto.LiveBiddingMessage.toObject = function (Be, Re) {
var Ue,
Ye = {
type: _e.Message.getFieldWithDefault(Re, 1, 0),
client: (Ue = Re.getClient()) && proto.ClientStruct.toObject(Be, Ue),
vente: (Ue = Re.getVente()) && proto.VenteStruct.toObject(Be, Ue),
message: _e.Message.getFieldWithDefault(Re, 4, ""),
paramsMap: (Ue = Re.getParamsMap()) ? Ue.toObject(Be, void 0) : [],
pingtime: _e.Message.getFieldWithDefault(Re, 6, 0),
};
return Be && (Ye.$jspbMessageInstance = Re), Ye;
})),
(proto.LiveBiddingMessage.deserializeBinary = function (Be) {
var Re = new _e.BinaryReader(Be),
Ue = new proto.LiveBiddingMessage();
return proto.LiveBiddingMessage.deserializeBinaryFromReader(Ue, Re);
}),
(proto.LiveBiddingMessage.deserializeBinaryFromReader = function (Be, Re) {
for (; Re.nextField() && !Re.isEndGroup(); ) {
switch (Re.getFieldNumber()) {
case 1:
var Ue = Re.readEnum();
Be.setType(Ue);
break;
case 2:
Ue = new proto.ClientStruct();
Re.readMessage(Ue, proto.ClientStruct.deserializeBinaryFromReader), Be.setClient(Ue);
break;
case 3:
Ue = new proto.VenteStruct();
Re.readMessage(Ue, proto.VenteStruct.deserializeBinaryFromReader), Be.setVente(Ue);
break;
case 4:
Ue = Re.readString();
Be.setMessage(Ue);
break;
case 5:
Ue = Be.getParamsMap();
Re.readMessage(Ue, function (Be, Re) {
_e.Map.deserializeBinary(Be, Re, _e.BinaryReader.prototype.readString, _e.BinaryReader.prototype.readString, null, "", "");
});
break;
case 6:
Ue = Re.readInt64();
Be.setPingtime(Ue);
break;
default:
Re.skipField();
}
}
return Be;
}),
(proto.LiveBiddingMessage.prototype.serializeBinary = function () {
var Be = new _e.BinaryWriter();
return proto.LiveBiddingMessage.serializeBinaryToWriter(this, Be), Be.getResultBuffer();
}),
(proto.LiveBiddingMessage.serializeBinaryToWriter = function (Be, Re) {
var Ue = void 0;
0 !== (Ue = Be.getType()) && Re.writeEnum(1, Ue),
null != (Ue = Be.getClient()) && Re.writeMessage(2, Ue, proto.ClientStruct.serializeBinaryToWriter),
null != (Ue = Be.getVente()) && Re.writeMessage(3, Ue, proto.VenteStruct.serializeBinaryToWriter),
(Ue = Be.getMessage()).length > 0 && Re.writeString(4, Ue),
(Ue = Be.getParamsMap(!0)) && Ue.getLength() > 0 && Ue.serializeBinary(5, Re, _e.BinaryWriter.prototype.writeString, _e.BinaryWriter.prototype.writeString),
0 !== (Ue = Be.getPingtime()) && Re.writeInt64(6, Ue);
}),
(proto.LiveBiddingMessage.Type = {
PING: 0,
PONG: 1,
INIT: 2,
CLOSE: 3,
BID: 4,
SELECT_LOT: 5,
STARTING_PRICE: 6,
INCREMENT: 7,
TENDERING: 8,
GENERIC_MESSAGE: 9,
CREATE_LOT: 10,
NOT_INTERESTED: 11,
INTERESTED: 12,
ACTIVITY: 13,
NEW_CLIENT: 14,
CLOSED_CLIENT: 15,
KILL: 16,
MULTILOT_REQUEST: 17,
MULTILOT_RESPONSE: 18,
SYNC_PAYMENT_LIMIT: 19,
SWITCH_FREE_BID_AUTHORIZE: 20,
REFRESH_CLIENTS_COUNT: 21,
}),
(proto.LiveBiddingMessage.prototype.getType = function () {
return _e.Message.getFieldWithDefault(this, 1, 0);
}),
(proto.LiveBiddingMessage.prototype.setType = function (Be) {
return _e.Message.setProto3EnumField(this, 1, Be);
}),
(proto.LiveBiddingMessage.prototype.getClient = function () {
return _e.Message.getWrapperField(this, proto.ClientStruct, 2);
}),
(proto.LiveBiddingMessage.prototype.setClient = function (Be) {
return _e.Message.setWrapperField(this, 2, Be);
}),
(proto.LiveBiddingMessage.prototype.clearClient = function () {
return this.setClient(void 0);
}),
(proto.LiveBiddingMessage.prototype.hasClient = function () {
return null != _e.Message.getField(this, 2);
}),
(proto.LiveBiddingMessage.prototype.getVente = function () {
return _e.Message.getWrapperField(this, proto.VenteStruct, 3);
}),
(proto.LiveBiddingMessage.prototype.setVente = function (Be) {
return _e.Message.setWrapperField(this, 3, Be);
}),
(proto.LiveBiddingMessage.prototype.clearVente = function () {
return this.setVente(void 0);
}),
(proto.LiveBiddingMessage.prototype.hasVente = function () {
return null != _e.Message.getField(this, 3);
}),
(proto.LiveBiddingMessage.prototype.getMessage = function () {
return _e.Message.getFieldWithDefault(this, 4, "");
}),
(proto.LiveBiddingMessage.prototype.setMessage = function (Be) {
return _e.Message.setProto3StringField(this, 4, Be);
}),
(proto.LiveBiddingMessage.prototype.getParamsMap = function (Be) {
return _e.Message.getMapField(this, 5, Be, null);
}),
(proto.LiveBiddingMessage.prototype.clearParamsMap = function () {
return this.getParamsMap().clear(), this;
}),
(proto.LiveBiddingMessage.prototype.getPingtime = function () {
return _e.Message.getFieldWithDefault(this, 6, 0);
}),
(proto.LiveBiddingMessage.prototype.setPingtime = function (Be) {
return _e.Message.setProto3IntField(this, 6, Be);
}),
Ye.object.extend(Re, proto);
const Ze = proto.LiveBiddingMessage,
$e = proto.VenteStruct,
tt = proto.ClientStruct,
nt = proto.BidStruct,
rt = proto.LotStruct,
ot = proto.IncrementStruct,
it = proto.IncrementData,
at = proto.IncrementStep;
@@ -23,6 +23,7 @@ class Interencheres extends Scraper {
this._USER = ""
this._PWD = ""
this._PATH_SESSION_FILE = ".session/session_inter.json"
this._BROWSER_TOOL = "puppeteerBrowser"
}
getPictures = async ({ page, data}) => {
@@ -148,21 +149,41 @@ class Interencheres extends Scraper {
return LotList
}
// ### Puppeteer
// ###########################################################################
async CheckCookieDialog(page) {
console.log("-- CheckCookieDialog --")
return new Promise(async (resolve, reject) => {
const CookieButton = await page.$('//button[contains(@class, "cpm-cookies-bar-cta-refus") and contains(text(), "Refuser")]');
//console.log(CookieButton)
if (CookieButton && await CookieButton.isVisible()) {
console.log("-- Click on CookieButton --")
await CookieButton.click();
}
resolve(true)
})
}
Live = async (browser) => {
console.log("Live "+this._Name+": "+this.Url)
const page = await browser.newPage();
let CheckAskStop = null;
let Socket = null;
const StopLive = async (params) => {
clearInterval(CheckAskStop);
Socket.off('Network.webSocketFrameReceived', listener);
//Socket.off('Network.webSocketFrameReceived', listener);
page.close()
browser.close()
}
const listener = async (params) => {
let payload = params.response.payloadData
if(payload.length>1 && payload.substring(0, 2) == '42'){
payload = JSON.parse(payload.substring(2))
@@ -246,6 +267,7 @@ class Interencheres extends Scraper {
try{
await page.goto(this.Url);
Socket = await page.target().createCDPSession();
await Socket.send('Network.enable');
await Socket.send('Page.enable');
@@ -260,7 +282,7 @@ class Interencheres extends Scraper {
StopLive()
}
})
}, 10000); // 10000 milliseconds = 10 seconds
}, 5000); // 10000 milliseconds = 5 seconds
}catch(e){
console.log('Error : '+e)
@@ -299,7 +299,8 @@ class InterencheresData extends ScraperTools {
const SaleTitleXPath = [
'/html/body/div[1]/div/div/div/main/div/div/div/div/div/div[1]/div/div[1]/div[2]/h1/div/div/div/div/div',
'/html/body/div[1]/div/div/div/main/div/div/div/div/div/div[1]/div/div/div/h1/div/div/div/div/div',
'/html/body/div[1]/div/div/div/main/div/div/div/div/div/div[1]/div/div/div/div/h1/div/div/div/div/div'
'/html/body/div[1]/div/div/div/main/div/div/div/div/div/div[1]/div/div/div/div/h1/div/div/div/div/div',
'/html/body/div[1]/div/div/div[1]/main/div/div/div/div/div/div[1]/div/div/div/div/h1/div/div/div/div/div'
]
let SaleTitle = await this.getTextContent(SaleTitleXPath, page, 'SaleTitleXPath')
return SaleTitle
+32 -16
View File
@@ -14,6 +14,8 @@ class Scraper {
_PATH_SESSION_FILE = ""
_BROWSER_TOOL = null
_Proxy = ""
_DebugMode = false
@@ -23,29 +25,43 @@ class Scraper {
this.Url = Url;
}
async _saveSession(page) {
async _getContext(browser) {
return new Promise(async (resolve, reject) => {
console.log('-- Save Session --')
const cookies = await page.cookies();
//console.log(cookies)
//await fs.writeFile(this._PATH_SESSION_FILE, JSON.stringify(cookies));
fs.writeFileSync(this._PATH_SESSION_FILE, JSON.stringify(cookies));
resolve(page)
try {
if (fs.existsSync(this._PATH_SESSION_FILE)) {
resolve(await browser.newContext({
storageState: this._PATH_SESSION_FILE,
timezoneId: 'Europe/Paris',
extraHTTPHeaders: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0',
'Accept-Language': 'fr-FR,fr;q=0.9'
}
}));
} else {
resolve(await browser.newContext({
timezoneId: 'Europe/Paris',
extraHTTPHeaders: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0',
'Accept-Language': 'fr-FR,fr;q=0.9'
}
}));
}
}catch(e){
console.error('Error: '+e)
reject(new Error('Error: '+e))
}
})
}
async _restoreSession(page) {
async _saveSession(page) {
return new Promise(async (resolve, reject) => {
if (fs.existsSync(this._PATH_SESSION_FILE)) {
console.log('-- restore Session --')
const cookies = JSON.parse(fs.readFileSync(this._PATH_SESSION_FILE));
await page.setCookie(...cookies);
}
console.log('-- Save Session --')
await page.context().storageState({ path: this._PATH_SESSION_FILE });
resolve(page)
})
}
getPictures({ page, data}) {