File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,10 @@ npm i @waylaidwanderer/chatgpt-api
128128import { BingAIClient } from ' @waylaidwanderer/chatgpt-api' ;
129129
130130const bingAIClient = new BingAIClient ({
131- userToken: ' ' , // "_U" cookie from bing.com
131+ // "_U" cookie from bing.com
132+ userToken: ' ' ,
133+ // If the above doesn't work, provide all your cookies as a string instead
134+ cookies: ' ' ,
132135 debug: false ,
133136});
134137
@@ -243,6 +246,8 @@ module.exports = {
243246 bingAiClient: {
244247 // The "_U" cookie value from bing.com
245248 userToken: ' ' ,
249+ // If the above doesn't work, provide all your cookies as a string instead
250+ cookies: ' ' ,
246251 // (Optional) Set to true to enable `console.debug()` logging
247252 debug: false ,
248253 },
Original file line number Diff line number Diff line change 11import { BingAIClient } from '../index.js' ;
22
33const bingAIClient = new BingAIClient ( {
4- userToken : '' , // "_U" cookie from bing.com
4+ // "_U" cookie from bing.com
5+ userToken : '' ,
6+ // If the above doesn't work, provide all your cookies as a string instead
7+ cookies : '' ,
58 debug : false ,
69} ) ;
710
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ export default {
2727 bingAiClient : {
2828 // The "_U" cookie value from bing.com
2929 userToken : '' ,
30+ // If the above doesn't work, provide all your cookies as a string instead
31+ cookies : '' ,
3032 // (Optional) Set to true to enable `console.debug()` logging
3133 debug : false ,
3234 } ,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import WebSocket from 'ws';
44
55export default class BingAIClient {
66 constructor ( opts ) {
7- this . userToken = opts . userToken ;
7+ this . opts = opts ;
88 this . debug = opts . debug ;
99 }
1010
@@ -28,7 +28,7 @@ export default class BingAIClient {
2828 "sec-fetch-site" : "same-origin" ,
2929 "x-ms-client-request-id" : crypto . randomUUID ( ) ,
3030 "x-ms-useragent" : "azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/Win32" ,
31- "cookie" : `_U=${ this . userToken } ` ,
31+ "cookie" : this . opts . cookies || `_U=${ this . opts . userToken } ` ,
3232 "Referer" : "https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx" ,
3333 "Referrer-Policy" : "origin-when-cross-origin"
3434 } ,
You can’t perform that action at this time.
0 commit comments