@@ -163,10 +163,10 @@ async function request(url, opt = {}) {
163163 let effectivePostType = postType ;
164164 if ( ! effectivePostType ) {
165165 // 查找不区分大小写的 Content-Type 头
166- const contentTypeKey = Object . keys ( headers ) . find ( key =>
166+ const contentTypeKey = Object . keys ( headers ) . find ( key =>
167167 key . toLowerCase ( ) === 'content-type'
168168 ) ;
169-
169+
170170 if ( contentTypeKey && headers [ contentTypeKey ] ) {
171171 const contentType = headers [ contentTypeKey ] . toLowerCase ( ) ;
172172 if ( contentType . includes ( 'application/x-www-form-urlencoded' ) ) {
@@ -176,7 +176,7 @@ async function request(url, opt = {}) {
176176 }
177177 }
178178 }
179-
179+
180180 // 根据有效的 postType 处理数据
181181 if ( effectivePostType === 'form' && data != null && typeof data === 'object' ) {
182182 data = qs . stringify ( data , { encode : false } ) ;
@@ -724,4 +724,48 @@ globalThis.jsonToCookie = jsonToCookie;
724724globalThis . cookieToJson = cookieToJson ;
725725globalThis . keysToLowerCase = keysToLowerCase ;
726726
727+ class BaseSpider {
728+ constructor ( ) {
729+ this . home = this . homeContent ;
730+ this . category = this . categoryContent ;
731+ // this.detail = this.detailContent;
732+ this . search = this . searchContent ;
733+ this . play = this . playerContent ;
734+ this . homeVod = this . homeVideoContent ;
735+ this . proxy = this . localProxy ;
736+ }
737+
738+ async fetch ( url , options ) {
739+ const content = ( await req ( url , options ) ) . content ;
740+ return { data : content . parseX } ;
741+ }
742+
743+ async homeContent ( ) {
744+ }
745+
746+ async categoryContent ( ) {
747+ }
748+
749+ async detailContent ( ) {
750+ }
751+
752+ async searchContent ( ) {
753+ }
754+
755+ async playerContent ( ) {
756+ }
757+
758+ async homeVideoContent ( ) {
759+ }
760+
761+ async localProxy ( ) {
762+
763+ }
764+
765+ async action ( ) {
766+
767+ }
768+ }
769+
770+ globalThis . BaseSpider = BaseSpider ;
727771export default { } ;
0 commit comments