# Fetching train availability in IRCTC

### Problem

When you search for trains in [irctc](https://www.irctc.co.in) page, it never shows the seat availability directly. You'll have to manually go and click the refresh button of every listed train

<figure><img src="/files/wfiJdpkkDXXqMtHFr5lf" alt=""><figcaption><p>List of trains, but availability is not present</p></figcaption></figure>

### Steps to fix

1. Search for trains in <https://www.irctc.co.in>
2. Apply filters to narrow down the list of trains

   <figure><img src="/files/19TPzjipnWWIXwKU9y4N" alt=""><figcaption><p>Narrow down list of trains using filters</p></figcaption></figure>
3. Paste the following script in console to get the availability status of all trains at once

```javascript
document.querySelectorAll('.fa.fa-repeat').forEach(el=>el.click())
```

4. The end. Tada!

### Note:

Ensure that you always try this out after narrowing down the list using filters. Else it'll be too many requests going on at once.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.aldrinjenson.com/tools-and-workflow/fetching-train-availability-in-irctc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
