timeeditapi
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -6,4 +6,4 @@ 'use strict'; | ||
const TimeEditAPi = class extends TimeEditCrawler { | ||
constructor(url1, url2){ | ||
super(url1, url2); | ||
constructor(url, types){ | ||
super(url, types); | ||
} | ||
@@ -10,0 +10,0 @@ |
'use strict'; | ||
const request = require('request'); | ||
const TimeEditCrawler = class { | ||
constructor(roomDataIdUrl, roomScheduleURL) { | ||
this.roomDataIdUrl = roomDataIdUrl; | ||
this.roomScheduleURL = roomScheduleURL; | ||
constructor(originUrl, types) { | ||
this.originUrl = originUrl; | ||
this.roomUrl = `objects.html?max=15&fr=t&partajax=t&im=f&sid=3&l=sv_SE&search_text=&types=${types}`; | ||
this.scheduleUrl = 'ri.json?h=f&sid=3&p=0.m%2C12.n&objects=&ox=0&types=0&fe=0&h2=f'; | ||
this.searchText = 'search_text='; | ||
@@ -27,11 +29,11 @@ this.objectsText = 'objects='; | ||
} | ||
buildRoomDataURL(roomId){ | ||
let urlArray = this._splitString(this.roomDataIdUrl, this.searchText); | ||
return this._joinString(urlArray, `${this.searchText}${roomId}`); | ||
let urlArray = this._splitString(this.roomUrl, this.searchText); | ||
return this.originUrl + this._joinString(urlArray, `${this.searchText}${roomId}`); | ||
} | ||
buildScheduleRoomURL(roomDataId){ | ||
let urlArray = this._splitString(this.roomScheduleURL, this.objectsText); | ||
return this._joinString(urlArray, `${this.objectsText}${roomDataId}`); | ||
let urlArray = this._splitString(this.scheduleUrl, this.objectsText); | ||
return this.originUrl + this._joinString(urlArray, `${this.objectsText}${roomDataId}`); | ||
} | ||
@@ -38,0 +40,0 @@ |
{ | ||
"name": "timeeditapi", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "api to easy get schedule information from timeedit", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7082
171
20