Giter Site home page Giter Site logo

suryavaddiraju / irctc-api Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 3.0 1.5 MB

A NodeJS only package built on top of IRCTC Website APIs to book train tickets, managing user profile faster and simpler.

Home Page: https://dev.vaddiraju.in/irctc-api/

License: Apache License 2.0

JavaScript 100.00%
api booking cli command india indian irctc javascript node npm

irctc-api's Introduction

A package built on top of IRCTC Website APIs to book train tickets, managing user profile faster and simpler. Currently this package only works on NodeJs environment and we were not recommending this to use on browser or any other Javascript environment.

NPM Downloads Dynamic JSON Badge Contributors GitHub License Dynamic JSON Badge GitHub Issues or Pull Requests GitHub last commit GitHub Actions Workflow Status

Note

This irctc-api script for automating IRCTC ticket booking
is created strictly for educational purposes. The code and its
usage are intended to showcase irctc-api testing capabilities and
best practices. Any attempt to use this script for unauthorized
access or activities that violate IRCTC terms of service or legal
regulations is strictly prohibited. The author(s) and associated
entities are not responsible for any misuse or legal consequences 
resulting from the use of this script for any unauthorized 
activities.

Useful Links

GitHub Logo npm Logo Documentation Logo

Installing

To install the this package, simply type i or install irctc-api using the node package manager

npm install irctc-api

Prerequisite

This Package uses viu, A rust module uses iterm image protocol for displaying images within System Terminal.

We use that for displaying captcha images on command line for login and bookings as to make your booking flow in a seamless way.

irctc-api automatically installs viu binary based on your os and processor architecture, If we could not find your viu binary related to your processor and os, you are required to install viu through their standard installation.

Then provide viu binary path in params as

{
  "train_number": "11020",
  "viu":"path/to/binary/viu | path/to/binary/viu.exe"
}

Notes

  • Currently this project is designed to accept only UPI Collect request as payment option and other payment modes are not supported as of now. When the payment request is initiated, The command line will display the payment request details such that you need to complete the payment from your UPI mobile App.

Import

This Package exports a class named IRCTC which contains three functions.

  • book
  • last_transaction
  • pnr_status

To send a request, you only need to import the IRCTC.

// ES5 example
const { IRCTC } = require("irctc-api");
// ES6+ example
import { IRCTC } from "irctc-api";

Examples

The Code Examples are hosted at Github Repo - suryavaddiraju/irctc-api

Usage

To send a request, you:

  • Initiate IRCTC class
  • Call available function operation on class with input as javascript object.
// a client can be shared by different commands. But it is currently in development untill then use client seperately.
const client = new IRCTC();

const params = {
  // refer https://dev.vaddiraju.in/irctc-api/api_reference#book_input
};
const command = await client.book(params);

Async/await

We recommend using await operator to wait for the promise returned by send operation as follows:

// async/await.
try {
  const data = await client.book(params);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

Contributing

Any modifications will be overwritten the next time the irctc-api package is updated. To contribute to the package you can check our contribution page.

License

This package is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

book Command API Reference / Input / Output
last_transaction Command API Reference / Input / Output
pnr_status Command API Reference / Input / Output

Copyright

All Rights Reserved. © Vaddiraju Surya Teja, 2024

irctc-api's People

Contributors

suryavaddiraju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

irctc-api's Issues

ERROR after filling captcha

Getting this error after filling captcha in terminal

Uncaught ReferenceError ReferenceError: RQHNm is not defined
at (repl:1:1)

I started after 10.57AM , Script Exit Issue

Terminal out put

          protocol: 'https:',
          options: [Object: null prototype] {
            keepAlive: true,
            scheduling: 'lifo',
            timeout: 5000,
            noDelay: true,
            path: null
          },
          requests: [Object: null prototype] {},
          sockets: [Object: null prototype] {},
          freeSockets: [Object: null prototype] {},
          keepAliveMsecs: 1000,
          keepAlive: true,
          maxSockets: Infinity,
          maxFreeSockets: 256,
          scheduling: 'lifo',
          maxTotalSockets: Infinity,
          totalSocketCount: 0,
          maxCachedSessions: 100,
          _sessionCache: { map: {}, list: [] },
          [Symbol(shapeMode)]: false,
          [Symbol(kCapture)]: false
        },
        host: 'www.irctc.co.in',
        cookies: {
          jar: CookieJar {
            rejectPublicSuffixes: true,
            enableLooseMode: false,
            allowSpecialUseDomain: true,
            store: [MemoryCookieStore],
            prefixSecurity: 'silent',
            _cloneSync: [Function (anonymous)],
            _importCookiesSync: [Function (anonymous)],
            getCookiesSync: [Function (anonymous)],
            getCookieStringSync: [Function (anonymous)],
            getSetCookieStringsSync: [Function (anonymous)],
            removeAllCookiesSync: [Function (anonymous)],
            setCookieSync: [Function (anonymous)],
            serializeSync: [Function (anonymous)]
          }
        },
        noDelay: true,
        servername: 'www.irctc.co.in',
        _agentKey: 'www.irctc.co.in:443:::::::::::::::::::::',
        encoding: null,
        singleUse: true
      }
    },
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [ 'Accept', 'application/json, text/plain, */*' ],
      'content-type': [ 'Content-Type', 'application/json; charset=UTF-8' ],
      'accept-encoding': [ 'Accept-Encoding', 'gzip, deflate, br, zstd' ],
      'accept-language': [ 'Accept-Language', 'en-US,en;q=0.0' ],
      authorization: [
        'Authorization',
        'Bearer b3010a7f-c39c-482c-8a19-3a0c1d9a9792'
      ],
      connection: [ 'Connection', 'keep-alive' ],
      'content-language': [ 'Content-Language', 'en' ],
      'content-length': [ 'Content-Length', '404' ],
      dnt: [ 'DNT', '1' ],
      host: [ 'Host', 'www.irctc.co.in' ],
      origin: [ 'Origin', 'https://www.irctc.co.in' ],
      referer: [ 'Referer', 'https://www.irctc.co.in/nget/booking/train-list' ],
      'sec-fetch-dest': [ 'Sec-Fetch-Dest', 'empty' ],
      'sec-fetch-mode': [ 'Sec-Fetch-Mode', 'cors' ],
      'sec-fetch-site': [ 'Sec-Fetch-Site', 'same-origin' ],
      'user-agent': [
        'User-Agent',
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
      ],
      bmirak: [ 'bmirak', 'webbm' ],
      bmiyek: [ 'bmiyek', '07C70D80F95505911DC4F4D8A1417982' ],
      greq: [ 'greq', 'GQ:9ab204a9-9f04-4d55-9c4d-2e25f3d9c4dc' ],
      'sec-ch-ua': [
        'sec-ch-ua',
        '"Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"'
      ],
      'sec-ch-ua-mobile': [ 'sec-ch-ua-mobile', '?0' ],
      'sec-ch-ua-platform': [ 'sec-ch-ua-platform', '"Windows"' ],
      'spa-csrf-token': [ 'spa-csrf-token', '1714714213214--874522748' ],
      cookie: [
        'Cookie',
        'TS018d84e5=01d83d9ce720dc3bf82b68ec809daf6850994c794ecb96d60f03d2bdc9fdfd493328e1ff935be7f829af3d846066a51502fb655b66; JSESSIONID=Kng87HOz0Wbtcd3GhGensB5mcwqyqQ-TPfYEy4NwAMPaObtYCjXD!1261267277; et_appVIP1=1258442250.16927.0000'
      ]
    },
    [Symbol(errored)]: null,
    [Symbol(kHighWaterMark)]: 16384,
    [Symbol(kRejectNonStandardBodyWrites)]: false,
    [Symbol(kUniqueHeaders)]: null
  },
  response: {
    status: 502,
    statusText: 'Bad Gateway',
    headers: Object [AxiosHeaders] {
      date: 'Fri, 03 May 2024 05:30:28 GMT',
      'content-type': 'text/html',
      'content-length': '401',
      connection: 'keep-alive',
      etag: '"65b23952-191"',
      'cache-control': 'no-cache, no-store, must-revalidate, max-age=0',
      pragma: 'no-cache',
      'strict-transport-security': 'max-age=31536000; preload'
    },
    config: {
      transitional: {
        silentJSONParsing: true,
        forcedJSONParsing: true,
        clarifyTimeoutError: false
      },
      adapter: [ 'xhr', 'http' ],
      transformRequest: [ [Function: transformRequest] ],
      transformResponse: [ [Function: transformResponse] ],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: {
        FormData: [Function: FormData] {
          LINE_BREAK: '\r\n',
          DEFAULT_CONTENT_TYPE: 'application/octet-stream'
        },
        Blob: [class Blob]
      },
      validateStatus: [Function: validateStatus],
      headers: Object [AxiosHeaders] {
        Accept: 'application/json, text/plain, */*',
        'Content-Type': 'application/json; charset=UTF-8',
        'Accept-Encoding': 'gzip, deflate, br, zstd',
        'Accept-Language': 'en-US,en;q=0.0',
        Authorization: 'Bearer b3010a7f-c39c-482c-8a19-3a0c1d9a9792',
        Connection: 'keep-alive',
        'Content-Language': 'en',
        'Content-Length': '404',
        DNT: '1',
        Host: 'www.irctc.co.in',
        Origin: 'https://www.irctc.co.in',
        Referer: 'https://www.irctc.co.in/nget/booking/train-list',
        'Sec-Fetch-Dest': 'empty',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Site': 'same-origin',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0',
        bmirak: 'webbm',
        bmiyek: '07C70D80F95505911DC4F4D8A1417982',
        greq: 'GQ:9ab204a9-9f04-4d55-9c4d-2e25f3d9c4dc',
        'sec-ch-ua': '"Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"Windows"',
        'spa-csrf-token': '1714714213214--874522748'
      },
      jar: CookieJar {
        rejectPublicSuffixes: true,
        enableLooseMode: false,
        allowSpecialUseDomain: true,
        store: MemoryCookieStore {
          synchronous: true,
          idx: [Object: null prototype] {
            'www.irctc.co.in': [Object: null prototype]
          },
          [Symbol(nodejs.util.inspect.custom)]: [Function: inspect]
        },
        prefixSecurity: 'silent',
        _cloneSync: [Function (anonymous)],
        _importCookiesSync: [Function (anonymous)],
        getCookiesSync: [Function (anonymous)],
        getCookieStringSync: [Function (anonymous)],
        getSetCookieStringsSync: [Function (anonymous)],
        removeAllCookiesSync: [Function (anonymous)],
        setCookieSync: [Function (anonymous)],
        serializeSync: [Function (anonymous)]
      },
      withCredentials: true,
      method: 'post',
      url: 'https://www.irctc.co.in/eticketing/protected/mapps1/boardingStationEnq',
      data: '{"clusterFlag":"N","onwardFlag":"N","cod":"false","reservationMode":"WS_TA_B2C","autoUpgradationSelected":false,"gnToCkOpted":false,"paymentType":1,"twoPhaseAuthRequired":false,"captureAddress":0,"alternateAvlInputDTO":[{"trainNo":"12661","destStn":"RJPM","srcStn":"TBM","jrnyDate":"20240504","quotaCode":"TQ","jrnyClass":"SL","concessionPassengers":false}],"passBooking":false,"journalistBooking":false}',
      httpAgent: CookieAgent {
        _events: [Object: null prototype] {
          free: [Function (anonymous)],
          newListener: [Function: maybeEnableKeylog]
        },
        _eventsCount: 2,
        _maxListeners: undefined,
        defaultPort: 80,
        protocol: 'http:',
        options: [Object: null prototype] {
          cookies: { jar: [CookieJar] },
          noDelay: true,
          path: null
        },
        requests: [Object: null prototype] {},
        sockets: [Object: null prototype] {},
        freeSockets: [Object: null prototype] {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        scheduling: 'lifo',
        maxTotalSockets: Infinity,
        totalSocketCount: 0,
        [Symbol(shapeMode)]: false,
        [Symbol(kCapture)]: false,
        [Symbol(cookieOptions)]: {
          jar: CookieJar {
            rejectPublicSuffixes: true,
            enableLooseMode: false,
            allowSpecialUseDomain: true,
            store: [MemoryCookieStore],
            prefixSecurity: 'silent',
            _cloneSync: [Function (anonymous)],
            _importCookiesSync: [Function (anonymous)],
            getCookiesSync: [Function (anonymous)],
            getCookieStringSync: [Function (anonymous)],
            getSetCookieStringsSync: [Function (anonymous)],
            removeAllCookiesSync: [Function (anonymous)],
            setCookieSync: [Function (anonymous)],
            serializeSync: [Function (anonymous)]
          }
        }
      },
      httpsAgent: CookieAgent {
        _events: [Object: null prototype] {
          free: [Function (anonymous)],
          newListener: [Function: maybeEnableKeylog]
        },
        _eventsCount: 2,
        _maxListeners: undefined,
        defaultPort: 443,
        protocol: 'https:',
        options: [Object: null prototype] {
          cookies: { jar: [CookieJar] },
          noDelay: true,
          path: null
        },
        requests: [Object: null prototype] {},
        sockets: [Object: null prototype] {
          'www.irctc.co.in:443:::::::::::::::::::::': [ [TLSSocket] ]
        },
        freeSockets: [Object: null prototype] {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        scheduling: 'lifo',
        maxTotalSockets: Infinity,
        totalSocketCount: 1,
        maxCachedSessions: 100,
        _sessionCache: {
          map: {
            'www.irctc.co.in:443:::::::::::::::::::::': [Buffer [Uint8Array]]
          },
          list: [ 'www.irctc.co.in:443:::::::::::::::::::::' ]
        },
        [Symbol(shapeMode)]: false,
        [Symbol(kCapture)]: false,
        [Symbol(cookieOptions)]: {
          jar: CookieJar {
            rejectPublicSuffixes: true,
            enableLooseMode: false,
            allowSpecialUseDomain: true,
            store: [MemoryCookieStore],
            prefixSecurity: 'silent',
            _cloneSync: [Function (anonymous)],
            _importCookiesSync: [Function (anonymous)],
            getCookiesSync: [Function (anonymous)],
            getCookieStringSync: [Function (anonymous)],
            getSetCookieStringsSync: [Function (anonymous)],
            removeAllCookiesSync: [Function (anonymous)],
            setCookieSync: [Function (anonymous)],
            serializeSync: [Function (anonymous)]
          }
        }
      }
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype] {
        abort: [Function (anonymous)],
        aborted: [Function (anonymous)],
        connect: [Function (anonymous)],
        error: [Function (anonymous)],
        socket: [Function (anonymous)],
        timeout: [Function (anonymous)],
        finish: [Function: requestOnFinish]
      },
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: '404',
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      _header: 'POST /eticketing/protected/mapps1/boardingStationEnq HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json; charset=UTF-8\r\n' +
        'Accept-Encoding: gzip, deflate, br, zstd\r\n' +
        'Accept-Language: en-US,en;q=0.0\r\n' +
        'Authorization: Bearer b3010a7f-c39c-482c-8a19-3a0c1d9a9792\r\n' +
        'Connection: keep-alive\r\n' +
        'Content-Language: en\r\n' +
        'Content-Length: 404\r\n' +
        'DNT: 1\r\n' +
        'Host: www.irctc.co.in\r\n' +
        'Origin: https://www.irctc.co.in\r\n' +
        'Referer: https://www.irctc.co.in/nget/booking/train-list\r\n' +
        'Sec-Fetch-Dest: empty\r\n' +
        'Sec-Fetch-Mode: cors\r\n' +
        'Sec-Fetch-Site: same-origin\r\n' +
        'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0\r\n' +
        'bmirak: webbm\r\n' +
        'bmiyek: 07C70D80F95505911DC4F4D8A1417982\r\n' +
        'greq: GQ:9ab204a9-9f04-4d55-9c4d-2e25f3d9c4dc\r\n' +
        'sec-ch-ua: "Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"\r\n' +
        'sec-ch-ua-mobile: ?0\r\n' +
        'sec-ch-ua-platform: "Windows"\r\n' +
        'spa-csrf-token: 1714714213214--874522748\r\n' +
        'Cookie: TS018d84e5=01d83d9ce720dc3bf82b68ec809daf6850994c794ecb96d60f03d2bdc9fdfd493328e1ff935be7f829af3d846066a51502fb655b66; JSESSIONID=Kng87HOz0Wbtcd3GhGensB5mcwqyqQ-TPfYEy4NwAMPaObtYCjXD!1261267277; et_appVIP1=1258442250.16927.0000\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: CookieAgent {
        _events: [Object: null prototype] {
          free: [Function (anonymous)],
          newListener: [Function: maybeEnableKeylog]
        },
        _eventsCount: 2,
        _maxListeners: undefined,
        defaultPort: 443,
        protocol: 'https:',
        options: [Object: null prototype] {
          cookies: { jar: [CookieJar] },
          noDelay: true,
          path: null
        },
        requests: [Object: null prototype] {},
        sockets: [Object: null prototype] {
          'www.irctc.co.in:443:::::::::::::::::::::': [ [TLSSocket] ]
        },
        freeSockets: [Object: null prototype] {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        scheduling: 'lifo',
        maxTotalSockets: Infinity,
        totalSocketCount: 1,
        maxCachedSessions: 100,
        _sessionCache: {
          map: {
            'www.irctc.co.in:443:::::::::::::::::::::': [Buffer [Uint8Array]]
          },
          list: [ 'www.irctc.co.in:443:::::::::::::::::::::' ]
        },
        [Symbol(shapeMode)]: false,
        [Symbol(kCapture)]: false,
        [Symbol(cookieOptions)]: {
          jar: CookieJar {
            rejectPublicSuffixes: true,
            enableLooseMode: false,
            allowSpecialUseDomain: true,
            store: [MemoryCookieStore],
            prefixSecurity: 'silent',
            _cloneSync: [Function (anonymous)],
            _importCookiesSync: [Function (anonymous)],
            getCookiesSync: [Function (anonymous)],
            getCookieStringSync: [Function (anonymous)],
            getSetCookieStringsSync: [Function (anonymous)],
            removeAllCookiesSync: [Function (anonymous)],
            setCookieSync: [Function (anonymous)],
            serializeSync: [Function (anonymous)]
          }
        }
      },
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/eticketing/protected/mapps1/boardingStationEnq',
      _ended: true,
      res: IncomingMessage {
        _events: {
          close: undefined,
          error: [Function: handleStreamError],
          data: [Function: handleStreamData],
          end: [ [Function: responseOnEnd], [Function: handleStreamEnd] ],
          readable: undefined,
          finish: undefined,
          aborted: [Function: handlerStreamAborted]
        },
        _readableState: ReadableState {
          highWaterMark: 16384,
          buffer: [],
          bufferIndex: 0,
          length: 0,
          pipes: [],
          awaitDrainWriters: null,
          [Symbol(kState)]: 194779004
        },
        _maxListeners: undefined,
        socket: null,
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        httpVersion: '1.1',
        complete: true,
        rawHeaders: [
          'Date',
          'Fri, 03 May 2024 05:30:28 GMT',
          'Content-Type',
          'text/html',
          'Content-Length',
          '401',
          'Connection',
          'keep-alive',
          'ETag',
          '"65b23952-191"',
          'Cache-Control',
          'no-cache, no-store, must-revalidate, max-age=0',
          'Pragma',
          'no-cache',
          'Strict-Transport-Security',
          'max-age=31536000; preload'
        ],
        rawTrailers: [],
        joinDuplicateHeaders: undefined,
        aborted: false,
        upgrade: false,
        url: '',
        method: null,
        statusCode: 502,
        statusMessage: 'Bad Gateway',
        client: <ref *2> TLSSocket {
          _tlsOptions: {
            allowHalfOpen: undefined,
            pipe: false,
            secureContext: [SecureContext],
            isServer: false,
            requestCert: true,
            rejectUnauthorized: false,
            session: undefined,
            ALPNProtocols: undefined,
            requestOCSP: undefined,
            enableTrace: undefined,
            pskCallback: undefined,
            highWaterMark: undefined,
            onread: undefined,
            signal: undefined
          },
          _secureEstablished: true,
          _securePending: false,
          _newSessionPending: false,
          _controlReleased: true,
          secureConnecting: false,
          _SNICallback: null,
          servername: 'www.irctc.co.in',
          alpnProtocol: false,
          authorized: true,
          authorizationError: null,
          encrypted: true,
          _events: [Object: null prototype] {
            close: [Array],
            end: [Function: onReadableStreamEnd],
            error: undefined,
            newListener: [Function: keylogNewListener],
            connect: undefined,
            secure: [Function: onConnectSecure],
            session: [Function (anonymous)],
            free: [Function: onFree],
            timeout: [Function: onTimeout],
            agentRemove: [Function: onRemove],
            data: undefined,
            drain: undefined
          },
          _eventsCount: 8,
          connecting: false,
          _hadError: false,
          _parent: null,
          _host: 'www.irctc.co.in',
          _closeAfterHandlingError: false,
          _readableState: ReadableState {
            highWaterMark: 16384,
            buffer: [],
            bufferIndex: 0,
            length: 0,
            pipes: [],
            awaitDrainWriters: null,
            [Symbol(kState)]: 60303732
          },
          _writableState: WritableState {
            highWaterMark: 16384,
            length: 0,
            corked: 0,
            onwrite: [Function: bound onwrite],
            writelen: 0,
            bufferedIndex: 0,
            pendingcb: 0,
            [Symbol(kState)]: 17564020,
            [Symbol(kBufferedValue)]: null,
            [Symbol(kWriteCbValue)]: [Function (anonymous)]
          },
          allowHalfOpen: false,
          _maxListeners: undefined,
          _sockname: null,
          _pendingData: null,
          _pendingEncoding: '',
          server: undefined,
          _server: null,
          ssl: null,
          _requestCert: true,
          _rejectUnauthorized: false,
          parser: null,
          _httpMessage: [Circular *1],
          autoSelectFamilyAttemptedAddresses: [ '103.252.142.21:443' ],
          [Symbol(alpncallback)]: null,
          [Symbol(res)]: TLSWrap {
            _parent: [TCP],
            _parentWrap: null,
            _secureContext: [SecureContext],
            reading: true,
            onkeylog: [Function: onkeylog],
            onhandshakestart: {},
            onhandshakedone: [Function (anonymous)],
            onocspresponse: [Function: onocspresponse],
            onnewsession: [Function: onnewsessionclient],
            onerror: [Function: onerror],
            [Symbol(owner_symbol)]: [Circular *2]
          },
          [Symbol(verified)]: true,
          [Symbol(pendingSession)]: null,
          [Symbol(async_id_symbol)]: 868,
          [Symbol(kHandle)]: null,
          [Symbol(lastWriteQueueSize)]: 0,
          [Symbol(timeout)]: null,
          [Symbol(kBuffer)]: null,
          [Symbol(kBufferCb)]: null,
          [Symbol(kBufferGen)]: null,
          [Symbol(shapeMode)]: true,
          [Symbol(kCapture)]: false,
          [Symbol(kSetNoDelay)]: false,
          [Symbol(kSetKeepAlive)]: true,
          [Symbol(kSetKeepAliveInitialDelay)]: 60,
          [Symbol(kBytesRead)]: 693,
          [Symbol(kBytesWritten)]: 1610,
          [Symbol(connect-options)]: {
            rejectUnauthorized: false,
            ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
            checkServerIdentity: [Function: checkServerIdentity],
            minDHSize: 1024,
            maxRedirects: 21,
            maxBodyLength: Infinity,
            protocol: 'https:',
            path: null,
            method: 'POST',
            headers: [Object: null prototype],
            agents: [Object],
            auth: undefined,
            family: undefined,
            beforeRedirect: [Function: dispatchBeforeRedirect],
            beforeRedirects: [Object],
            hostname: 'www.irctc.co.in',
            port: 443,
            agent: [CookieAgent],
            nativeProtocols: [Object],
            pathname: '/eticketing/protected/mapps1/boardingStationEnq',
            _defaultAgent: [Agent],
            host: 'www.irctc.co.in',
            cookies: [Object],
            noDelay: true,
            servername: 'www.irctc.co.in',
            _agentKey: 'www.irctc.co.in:443:::::::::::::::::::::',
            encoding: null,
            singleUse: true
          }
        },
        _consuming: false,
        _dumped: false,
        req: [Circular *1],
        _eventsCount: 4,
        responseUrl: 'https://www.irctc.co.in/eticketing/protected/mapps1/boardingStationEnq',
        redirects: [],
        [Symbol(shapeMode)]: true,
        [Symbol(kCapture)]: false,
        [Symbol(kHeaders)]: {
          date: 'Fri, 03 May 2024 05:30:28 GMT',
          'content-type': 'text/html',
          'content-length': '401',
          connection: 'keep-alive',
          etag: '"65b23952-191"',
          'cache-control': 'no-cache, no-store, must-revalidate, max-age=0',
          pragma: 'no-cache',
          'strict-transport-security': 'max-age=31536000; preload'
        },
        [Symbol(kHeadersCount)]: 16,
        [Symbol(kTrailers)]: null,
        [Symbol(kTrailersCount)]: 0
      },
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'www.irctc.co.in',
      protocol: 'https:',
      _implicitHeader: [Function (anonymous)],
      emit: [Function (anonymous)],
      _redirectable: Writable {
        _events: {
          close: undefined,
          error: [Function: handleRequestError],
          prefinish: undefined,
          finish: undefined,
          drain: undefined,
          response: [Function: handleResponse],
          socket: [Function: handleRequestSocket]
        },
        _writableState: WritableState {
          highWaterMark: 16384,
          length: 0,
          corked: 0,
          onwrite: [Function: bound onwrite],
          writelen: 0,
          bufferedIndex: 0,
          pendingcb: 0,
          [Symbol(kState)]: 17580812,
          [Symbol(kBufferedValue)]: null
        },
        _maxListeners: undefined,
        _options: {
          maxRedirects: 21,
          maxBodyLength: Infinity,
          protocol: 'https:',
          path: '/eticketing/protected/mapps1/boardingStationEnq',
          method: 'POST',
          headers: [Object: null prototype] {
            Accept: 'application/json, text/plain, */*',
            'Content-Type': 'application/json; charset=UTF-8',
            'Accept-Encoding': 'gzip, deflate, br, zstd',
            'Accept-Language': 'en-US,en;q=0.0',
            Authorization: 'Bearer b3010a7f-c39c-482c-8a19-3a0c1d9a9792',
            Connection: 'keep-alive',
            'Content-Language': 'en',
            'Content-Length': '404',
            DNT: '1',
            Host: 'www.irctc.co.in',
            Origin: 'https://www.irctc.co.in',
            Referer: 'https://www.irctc.co.in/nget/booking/train-list',
            'Sec-Fetch-Dest': 'empty',
            'Sec-Fetch-Mode': 'cors',
            'Sec-Fetch-Site': 'same-origin',
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0',
            bmirak: 'webbm',
            bmiyek: '07C70D80F95505911DC4F4D8A1417982',
            greq: 'GQ:9ab204a9-9f04-4d55-9c4d-2e25f3d9c4dc',
            'sec-ch-ua': '"Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'spa-csrf-token': '1714714213214--874522748'
          },
          agents: { http: [CookieAgent], https: [CookieAgent] },
          auth: undefined,
          family: undefined,
          beforeRedirect: [Function: dispatchBeforeRedirect],
          beforeRedirects: { proxy: [Function: beforeRedirect] },
          hostname: 'www.irctc.co.in',
          port: '',
          agent: CookieAgent {
            _events: [Object: null prototype],
            _eventsCount: 2,
            _maxListeners: undefined,
            defaultPort: 443,
            protocol: 'https:',
            options: [Object: null prototype],
            requests: [Object: null prototype] {},
            sockets: [Object: null prototype],
            freeSockets: [Object: null prototype] {},
            keepAliveMsecs: 1000,
            keepAlive: false,
            maxSockets: Infinity,
            maxFreeSockets: 256,
            scheduling: 'lifo',
            maxTotalSockets: Infinity,
            totalSocketCount: 1,
            maxCachedSessions: 100,
            _sessionCache: [Object],
            [Symbol(shapeMode)]: false,
            [Symbol(kCapture)]: false,
            [Symbol(cookieOptions)]: [Object]
          },
          nativeProtocols: { 'http:': [Object], 'https:': [Object] },
          pathname: '/eticketing/protected/mapps1/boardingStationEnq'
        },
        _ended: true,
        _ending: true,
        _redirectCount: 0,
        _redirects: [],
        _requestBodyLength: 404,
        _requestBodyBuffers: [],
        _eventsCount: 3,
        _onNativeResponse: [Function (anonymous)],
        _currentRequest: [Circular *1],
        _currentUrl: 'https://www.irctc.co.in/eticketing/protected/mapps1/boardingStationEnq',
        [Symbol(shapeMode)]: true,
        [Symbol(kCapture)]: false
      },
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kChunkedBuffer)]: [],
      [Symbol(kChunkedLength)]: 0,
      [Symbol(kSocket)]: <ref *2> TLSSocket {
        _tlsOptions: {
          allowHalfOpen: undefined,
          pipe: false,
          secureContext: SecureContext { context: SecureContext {} },
          isServer: false,
          requestCert: true,
          rejectUnauthorized: false,
          session: undefined,
          ALPNProtocols: undefined,
          requestOCSP: undefined,
          enableTrace: undefined,
          pskCallback: undefined,
          highWaterMark: undefined,
          onread: undefined,
          signal: undefined
        },
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        secureConnecting: false,
        _SNICallback: null,
        servername: 'www.irctc.co.in',
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object: null prototype] {
          close: [
            [Function: onSocketCloseDestroySSL],
            [Function],
            [Function: onClose]
          ],
          end: [Function: onReadableStreamEnd],
          error: undefined,
          newListener: [Function: keylogNewListener],
          connect: undefined,
          secure: [Function: onConnectSecure],
          session: [Function (anonymous)],
          free: [Function: onFree],
          timeout: [Function: onTimeout],
          agentRemove: [Function: onRemove],
          data: undefined,
          drain: undefined
        },
        _eventsCount: 8,
        connecting: false,
        _hadError: false,
        _parent: null,
        _host: 'www.irctc.co.in',
        _closeAfterHandlingError: false,
        _readableState: ReadableState {
          highWaterMark: 16384,
          buffer: [],
          bufferIndex: 0,
          length: 0,
          pipes: [],
          awaitDrainWriters: null,
          [Symbol(kState)]: 60303732
        },
        _writableState: WritableState {
          highWaterMark: 16384,
          length: 0,
          corked: 0,
          onwrite: [Function: bound onwrite],
          writelen: 0,
          bufferedIndex: 0,
          pendingcb: 0,
          [Symbol(kState)]: 17564020,
          [Symbol(kBufferedValue)]: null,
          [Symbol(kWriteCbValue)]: [Function (anonymous)]
        },
        allowHalfOpen: false,
        _maxListeners: undefined,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: false,
        parser: null,
        _httpMessage: [Circular *1],
        autoSelectFamilyAttemptedAddresses: [ '103.252.142.21:443' ],
        [Symbol(alpncallback)]: null,
        [Symbol(res)]: TLSWrap {
          _parent: TCP {
            reading: [Getter/Setter],
            onconnection: null,
            [Symbol(owner_symbol)]: [Circular *2],
            [Symbol(handle_onclose)]: [Function: done]
          },
          _parentWrap: null,
          _secureContext: SecureContext { context: SecureContext {} },
          reading: true,
          onkeylog: [Function: onkeylog],
          onhandshakestart: {},
          onhandshakedone: [Function (anonymous)],
          onocspresponse: [Function: onocspresponse],
          onnewsession: [Function: onnewsessionclient],
          onerror: [Function: onerror],
          [Symbol(owner_symbol)]: [Circular *2]
        },
        [Symbol(verified)]: true,
        [Symbol(pendingSession)]: null,
        [Symbol(async_id_symbol)]: 868,
        [Symbol(kHandle)]: null,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBuffer)]: null,
        [Symbol(kBufferCb)]: null,
        [Symbol(kBufferGen)]: null,
        [Symbol(shapeMode)]: true,
        [Symbol(kCapture)]: false,
        [Symbol(kSetNoDelay)]: false,
        [Symbol(kSetKeepAlive)]: true,
        [Symbol(kSetKeepAliveInitialDelay)]: 60,
        [Symbol(kBytesRead)]: 693,
        [Symbol(kBytesWritten)]: 1610,
        [Symbol(connect-options)]: {
          rejectUnauthorized: false,
          ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
          checkServerIdentity: [Function: checkServerIdentity],
          minDHSize: 1024,
          maxRedirects: 21,
          maxBodyLength: Infinity,
          protocol: 'https:',
          path: null,
          method: 'POST',
          headers: [Object: null prototype] {
            Accept: 'application/json, text/plain, */*',
            'Content-Type': 'application/json; charset=UTF-8',
            'Accept-Encoding': 'gzip, deflate, br, zstd',
            'Accept-Language': 'en-US,en;q=0.0',
            Authorization: 'Bearer b3010a7f-c39c-482c-8a19-3a0c1d9a9792',
            Connection: 'keep-alive',
            'Content-Language': 'en',
            'Content-Length': '404',
            DNT: '1',
            Host: 'www.irctc.co.in',
            Origin: 'https://www.irctc.co.in',
            Referer: 'https://www.irctc.co.in/nget/booking/train-list',
            'Sec-Fetch-Dest': 'empty',
            'Sec-Fetch-Mode': 'cors',
            'Sec-Fetch-Site': 'same-origin',
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0',
            bmirak: 'webbm',
            bmiyek: '07C70D80F95505911DC4F4D8A1417982',
            greq: 'GQ:9ab204a9-9f04-4d55-9c4d-2e25f3d9c4dc',
            'sec-ch-ua': '"Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'spa-csrf-token': '1714714213214--874522748'
          },
          agents: { http: [CookieAgent], https: [CookieAgent] },
          auth: undefined,
          family: undefined,
          beforeRedirect: [Function: dispatchBeforeRedirect],
          beforeRedirects: { proxy: [Function: beforeRedirect] },
          hostname: 'www.irctc.co.in',
          port: 443,
          agent: CookieAgent {
            _events: [Object: null prototype],
            _eventsCount: 2,
            _maxListeners: undefined,
            defaultPort: 443,
            protocol: 'https:',
            options: [Object: null prototype],
            requests: [Object: null prototype] {},
            sockets: [Object: null prototype],
            freeSockets: [Object: null prototype] {},
            keepAliveMsecs: 1000,
            keepAlive: false,
            maxSockets: Infinity,
            maxFreeSockets: 256,
            scheduling: 'lifo',
            maxTotalSockets: Infinity,
            totalSocketCount: 1,
            maxCachedSessions: 100,
            _sessionCache: [Object],
            [Symbol(shapeMode)]: false,
            [Symbol(kCapture)]: false,
            [Symbol(cookieOptions)]: [Object]
          },
          nativeProtocols: { 'http:': [Object], 'https:': [Object] },
          pathname: '/eticketing/protected/mapps1/boardingStationEnq',
          _defaultAgent: Agent {
            _events: [Object: null prototype],
            _eventsCount: 2,
            _maxListeners: undefined,
            defaultPort: 443,
            protocol: 'https:',
            options: [Object: null prototype],
            requests: [Object: null prototype] {},
            sockets: [Object: null prototype] {},
            freeSockets: [Object: null prototype] {},
            keepAliveMsecs: 1000,
            keepAlive: true,
            maxSockets: Infinity,
            maxFreeSockets: 256,
            scheduling: 'lifo',
            maxTotalSockets: Infinity,
            totalSocketCount: 0,
            maxCachedSessions: 100,
            _sessionCache: [Object],
            [Symbol(shapeMode)]: false,
            [Symbol(kCapture)]: false
          },
          host: 'www.irctc.co.in',
          cookies: { jar: [CookieJar] },
          noDelay: true,
          servername: 'www.irctc.co.in',
          _agentKey: 'www.irctc.co.in:443:::::::::::::::::::::',
          encoding: null,
          singleUse: true
        }
      },
      [Symbol(kOutHeaders)]: [Object: null prototype] {
        accept: [ 'Accept', 'application/json, text/plain, */*' ],
        'content-type': [ 'Content-Type', 'application/json; charset=UTF-8' ],
        'accept-encoding': [ 'Accept-Encoding', 'gzip, deflate, br, zstd' ],
        'accept-language': [ 'Accept-Language', 'en-US,en;q=0.0' ],
        authorization: [
          'Authorization',
          'Bearer b3010a7f-c39c-482c-8a19-3a0c1d9a9792'
        ],
        connection: [ 'Connection', 'keep-alive' ],
        'content-language': [ 'Content-Language', 'en' ],
        'content-length': [ 'Content-Length', '404' ],
        dnt: [ 'DNT', '1' ],
        host: [ 'Host', 'www.irctc.co.in' ],
        origin: [ 'Origin', 'https://www.irctc.co.in' ],
        referer: [
          'Referer',
          'https://www.irctc.co.in/nget/booking/train-list'
        ],
        'sec-fetch-dest': [ 'Sec-Fetch-Dest', 'empty' ],
        'sec-fetch-mode': [ 'Sec-Fetch-Mode', 'cors' ],
        'sec-fetch-site': [ 'Sec-Fetch-Site', 'same-origin' ],
        'user-agent': [
          'User-Agent',
          'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
        ],
        bmirak: [ 'bmirak', 'webbm' ],
        bmiyek: [ 'bmiyek', '07C70D80F95505911DC4F4D8A1417982' ],
        greq: [ 'greq', 'GQ:9ab204a9-9f04-4d55-9c4d-2e25f3d9c4dc' ],
        'sec-ch-ua': [
          'sec-ch-ua',
          '"Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"'
        ],
        'sec-ch-ua-mobile': [ 'sec-ch-ua-mobile', '?0' ],
        'sec-ch-ua-platform': [ 'sec-ch-ua-platform', '"Windows"' ],
        'spa-csrf-token': [ 'spa-csrf-token', '1714714213214--874522748' ],
        cookie: [
          'Cookie',
          'TS018d84e5=01d83d9ce720dc3bf82b68ec809daf6850994c794ecb96d60f03d2bdc9fdfd493328e1ff935be7f829af3d846066a51502fb655b66; JSESSIONID=Kng87HOz0Wbtcd3GhGensB5mcwqyqQ-TPfYEy4NwAMPaObtYCjXD!1261267277; et_appVIP1=1258442250.16927.0000'
        ]
      },
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    data: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n' +
      '\n' +
      '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n' +
      '    <head>\n' +
      '        <title>IRCTC Next Generation eTicketing System</title>\n' +
      '        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n' +
      '    </head>\n' +
      '\n' +
      '    <body>\n' +
      '        <h1><strong>Server error!</strong></h1>\n' +
      '    </body>\n' +
      '</html>\n'
  }
}

Problem While Booking Tickets

  1. Stuck After Tatkal Opening Time:
  • When I log in before the Tatkal booking opens, the system waits as expected. However, even after the Tatkal booking time begins, the process continues to wait and does not proceed further.
  1. Website Unreachable Error:
  • The script frequently displays a "Website unreachable" error and then stops functioning. I have attempted to book tickets five times in both AC and SL Tatkal categories, but the same issue occurs each time.

Request for feature : Ticket Probability Status

Hey, first of all, awesome stuff. Thanks for spending, countless hours dealing with reversing the shitty website

Just wanted to request the ability to check the Ticket Probabilty, which is available before booking any ticket

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.