export namespace main { export class AttachLink { title: string; href: string; static createFrom(source: any = {}) { return new AttachLink(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.title = source["title"]; this.href = source["href"]; } } export class ResultItem { no: number; href: string; listTitle: string; listPubishTime: string; title: string; publishUnit: string; publishTime: string; content: string; contentHtml: string; attachLinks: AttachLink[]; attachJson: string; static createFrom(source: any = {}) { return new ResultItem(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.no = source["no"]; this.href = source["href"]; this.listTitle = source["listTitle"]; this.listPubishTime = source["listPubishTime"]; this.title = source["title"]; this.publishUnit = source["publishUnit"]; this.publishTime = source["publishTime"]; this.content = source["content"]; this.contentHtml = source["contentHtml"]; this.attachLinks = this.convertValues(source["attachLinks"], AttachLink); this.attachJson = source["attachJson"]; } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice && a.map) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } export class SpiderConfig { site: string; channel: string; author: string; url: string; code: string; listItemCss: string; listLinkCss: string; listPublishTimeCss: string; listNextPageCss: string; titleCss: string; publishUnitCss: string; publishTimeCss: string; contentCss: string; attachCss: string; listJs: string; contentJs: string; attachJs: string; static createFrom(source: any = {}) { return new SpiderConfig(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.site = source["site"]; this.channel = source["channel"]; this.author = source["author"]; this.url = source["url"]; this.code = source["code"]; this.listItemCss = source["listItemCss"]; this.listLinkCss = source["listLinkCss"]; this.listPublishTimeCss = source["listPublishTimeCss"]; this.listNextPageCss = source["listNextPageCss"]; this.titleCss = source["titleCss"]; this.publishUnitCss = source["publishUnitCss"]; this.publishTimeCss = source["publishTimeCss"]; this.contentCss = source["contentCss"]; this.attachCss = source["attachCss"]; this.listJs = source["listJs"]; this.contentJs = source["contentJs"]; this.attachJs = source["attachJs"]; } } }