Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the BOT #19

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open

Updating the BOT #19

wants to merge 37 commits into from

Conversation

Soroosh-N
Copy link

I cannot name all of the processes I have done for the project, but I think these changes are helpful to the main project. Some of the apparent changes which I have made can be mentioned below:

  • Adding an embassy.py file to expand the range of supported embassies.
  • Adding an esender.php file which can be handy for those with a server.
  • Changing some of the functions to facilitate the development of the Bot
  • Changing the README.md to describe the project even more.

@Soroosh-N
Copy link
Author

It's nice to see your changes to this tool, especially the WORK_COOLDOWN_TIME part. During use, I found a few problems: It couldn't locate case 'xpath' elements. So I commented lines 120 and 121, and changed line 71 to "https://ais.usvisa-info.com/{EMBASSY}/niv/users/sign_in ". It is used to auto-fill the account and password directly. Due to some updates yesterday, it is no longer possible to search the appointment date and time. I am looking for a way to fix it. Hope you can give me some advice.

Hi,
Actually, I'm developing the app even more. The new version cannot be released very soon, and that's because I don't have enough time to write the documentation for it right now (I'm working on my M.Sc. thesis) [2023 April 06]. However, I will fix the issues with the previous version that you are reviewing here. I know what the problem is, and I will solve it very soon (Maybe in 1 week or less? IDK). So, just keep watching my repository.
Best wishes

@JesseWest7
Copy link

Hola, I made a few changes to the code, and now it works just fine, searching for dates and returning data.
The changes are as follows,

lines 71; FIRST_PAGE_LINK = f"https://ais.usvisa-info.com/{EMBASSY}/niv/users/sign_in"

Lines 120-121;

        #case 'xpath':
            #item = driver.find_element(By.XPATH, el_type)

Lines 184; get_date and get_time;

def get_date():
    # driver.get(DATE_URL)
    driver.get(APPOINTMENT_URL)
    session = driver.get_cookie("_yatri_session")["value"]
    NEW_GET = driver.execute_script(
        "var req = new XMLHttpRequest();req.open('GET', '"
        + str(DATE_URL)
        + "', false);req.setRequestHeader('Accept', 'application/json, text/javascript, */*; q=0.01');req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); req.setRequestHeader('Cookie', '_yatri_session="
        + session
        + "'); req.send(null);return req.responseText;"
    )
    return json.loads(NEW_GET)


def get_time(date):
    time_url = TIME_URL % date
    session = driver.get_cookie("_yatri_session")["value"]
    content = driver.execute_script(
        "var req = new XMLHttpRequest();req.open('GET', '"
        + str(time_url)
        + "', false);req.setRequestHeader('Accept', 'application/json, text/javascript, */*; q=0.01');req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); req.setRequestHeader('Cookie', '_yatri_session="
        + session
        + "'); req.send(null);return req.responseText;"
    )
    data = json.loads(content)
    time = data.get("available_times")[-1]
    print(f"Got time successfully! {date} {time}")
    return time

Code has been debugged. A few changes have been made to make the code cleaner.
Debugged, Again!
@Soroosh-N
Copy link
Author

Hola, I made a few changes to the code, and now it works just fine, searching for dates and returning data. The changes are as follows,

lines 71; FIRST_PAGE_LINK = f"https://ais.usvisa-info.com/{EMBASSY}/niv/users/sign_in"

Lines 120-121;

        #case 'xpath':
            #item = driver.find_element(By.XPATH, el_type)

Lines 184; get_date and get_time;

def get_date():
    # driver.get(DATE_URL)
    driver.get(APPOINTMENT_URL)
    session = driver.get_cookie("_yatri_session")["value"]
    NEW_GET = driver.execute_script(
        "var req = new XMLHttpRequest();req.open('GET', '"
        + str(DATE_URL)
        + "', false);req.setRequestHeader('Accept', 'application/json, text/javascript, */*; q=0.01');req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); req.setRequestHeader('Cookie', '_yatri_session="
        + session
        + "'); req.send(null);return req.responseText;"
    )
    return json.loads(NEW_GET)


def get_time(date):
    time_url = TIME_URL % date
    session = driver.get_cookie("_yatri_session")["value"]
    content = driver.execute_script(
        "var req = new XMLHttpRequest();req.open('GET', '"
        + str(time_url)
        + "', false);req.setRequestHeader('Accept', 'application/json, text/javascript, */*; q=0.01');req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); req.setRequestHeader('Cookie', '_yatri_session="
        + session
        + "'); req.send(null);return req.responseText;"
    )
    data = json.loads(content)
    time = data.get("available_times")[-1]
    print(f"Got time successfully! {date} {time}")
    return time

Thanks to you, I updated the code, and it's working right now. I appreciate your contribution. I still kept the XPath, and I think it should work fine. You can check it again. Only download the visa.py, and after saving your own visa.py file, somewhere else, try mine. It should work well.
Again, Thank you

@deng-cy20
Copy link

Hi, I am thinking of a way of not being banned, at least not our own personal account. I think it is possible to register few extra accounts to search for the possible days without paying for the visa fee, and if there's an available day, we can login our personal account (or login in advance, it's an issue to keep the state of login) and then try to register that day. Do you think it's possible to integrate them? Thanks very much!

@Soroosh-N
Copy link
Author

Soroosh-N commented Apr 13, 2023

Hi, I am thinking of a way of not being banned, at least not our own personal account. I think it is possible to register few extra accounts to search for the possible days without paying for the visa fee, and if there's an available day, we can login our personal account (or login in advance, it's an issue to keep the state of login) and then try to register that day. Do you think it's possible to integrate them? Thanks very much!

Is it possible to have multiple accounts without payment? If it is possible, we can use their results as signals. The main account will wait (logged to the account) for the signal, then when we discover the desired time, we signal the main account, and it will reschedule itself. However, I think it's impossible to have multiple "free" accounts. I guess the companies have multiple paid accounts and will switch between them very fast. So, being banned is not something that bothers them.

@deng-cy20
Copy link

Hi, I am thinking of a way of not being banned, at least not our own personal account. I think it is possible to register few extra accounts to search for the possible days without paying for the visa fee, and if there's an available day, we can login our personal account (or login in advance, it's an issue to keep the state of login) and then try to register that day. Do you think it's possible to integrate them? Thanks very much!

Is it possible to have multiple accounts without payment? If it is possible, we can use their results as signals. The main account will wait (logged to the account) for the signal, then when we discover the desired time, we signal the main account, and it will reschedule itself. However, I think it's impossible to have multiple "free" accounts. I guess the companies have multiple paid accounts and will switch between them very fast. So, being banned is not something that bothers them. However, even they cannot determine which account can pick the discovered appointment. Being banned is a part of the process.

Yes, I think it's possible, as long as you have a reliable temp email website (that's another problem here, we need to find one that can pass the temp email detection). That's all you need to fake up a temp user account. Once you have that account, you can see the available appointment dates when you try to make the payment. Then we can use that result as the signal. I have tried it on Canada American visa system and it works. As long as it's in the AIS appointment system, I think it won't have much difference between countries.

image

@JesseWest7
Copy link

It is now working well, it is now a matter of thinking about not being banned, now retry time is more than 10 minutes, will cool down for 5 hours after 180 minutes, too short retry time will trigger the ban immediately after a few attempts. Given the 5-hour cooling-off period, I would assume that this would require at least 3 temporary accounts, taking turns to search for dates, and a retry time of no less than 10 minutes.

@JimCoala
Copy link

Hi Soroosh: I am trying to use your latest program, but found such a problem: often after running for a few hours, the user automatically signs out from the website, the program does not report an error, but stops at a certain position, and there is no Error message, I don't k
WeChat Image_20230413214111
now why. Attached screenshot.

@JesseWest7
Copy link

Hi @JimCoala
Check WORK_LIMIT_TIME = 1.5 and WORK_COOLDOWN_TIME = 2.25 in config.ini
This defines the program's working time and cooling time, which you can adjust.

@JimCoala
Copy link

Hi @JimCoala Check WORK_LIMIT_TIME = 1.5 and WORK_COOLDOWN_TIME = 2.25 in config.ini This defines the program's working time and cooling time, which you can adjust.

Thank you! I will try.

@Soroosh-N
Copy link
Author

Soroosh-N commented Apr 21, 2023

@deng-cy20
Sorry for my late answer. I'm doing my thesis, and I should finish it shortly. So, I don't have much time to develop this Bot right now.
I think you're right. We can work it out. Nevertheless, it needs a different version of the Bot, or at least it will be counted as a new one since not everyone can create signal accounts to use this Bot. So, I cannot develop this feature into this application. I should develop another one, and this process takes time. Maybe not sooner than entering my Ph.D. some months later :)
Sorry again.

@Soroosh-N
Copy link
Author

It is now working well, it is now a matter of thinking about not being banned, now retry time is more than 10 minutes, will cool down for 5 hours after 180 minutes, too short retry time will trigger the ban immediately after a few attempts. Given the 5-hour cooling-off period, I would assume that this would require at least 3 temporary accounts, taking turns to search for dates, and a retry time of no less than 10 minutes.

Hi,
Use rest times! Please don't use it monotonously.
After every 1.5 hours, let the Bot rests for like 30 minutes. In this case, the Bot can work 4.5 hours (6 hours with rests) before every ban incident. The ban is inevitable. I still cannot figure out how the algorithm works.

@Soroosh-N
Copy link
Author

Hi Soroosh: I am trying to use your latest program, but found such a problem: often after running for a few hours, the user automatically signs out from the website, the program does not report an error, but stops at a certain position, and there is no Error message, I don't k WeChat Image_20230413214111 now why. Attached screenshot.

Hi! The Bot will sign out, whenever it going to rest. Use the time configuration to solve this problem.

@exiett
Copy link

exiett commented Jun 7, 2023

@Soroosh-N Before anything, thank you for your work into updating this script. My girlfriend got denied the visa in June 1st and the bot managed to schedule the new one we issue on the 12th of the same month (next monday).

Although, I'd like to check with you if the script can handle the second mandatory scheduling on the CASV (Centro de Assistência ao Solicitante de Visto, from Portuguese, Center of Assistant to the Visa Applicant). In certain Brazilian consulates, the applicant must go first through the CASV to collect biometry and take the visa picture and then head to the interview at the Embassy. I'm not sure how this screen appears to you in different embassies websites but this is how it looks like in the Brazilian site:
Captura de Tela 2023-06-07 às 01 09 30

The most interesting in this situation is that an user cannot finish the process of scheduling the interview in the embassy without before selecting a date in the CASV but the script managed to finish the scheduling!
This is how it's supposed to look like, notice the two scheduled dates:
Captura de Tela 2023-06-07 às 01 19 31

This is what the script managed to do:
Captura de Tela 2023-06-07 às 01 14 13

Also, notice that the script failed to finish the scheduling but it scheduled the date successfully anyway:
image

Do you have any idea what could have happened for this situation to take place?

@Soroosh-N
Copy link
Author

@Soroosh-N Before anything, thank you for your work into updating this script. My girlfriend got denied the visa in June 1st and the bot managed to schedule the new one we issue on the 12th of the same month (next monday).

Although, I'd like to check with you if the script can handle the second mandatory scheduling on the CASV (Centro de Assistência ao Solicitante de Visto, from Portuguese, Center of Assistant to the Visa Applicant). In certain Brazilian consulates, the applicant must go first through the CASV to collect biometry and take the visa picture and then head to the interview at the Embassy. I'm not sure how this screen appears to you in different embassies websites but this is how it looks like in the Brazilian site: Captura de Tela 2023-06-07 às 01 09 30

The most interesting in this situation is that an user cannot finish the process of scheduling the interview in the embassy without before selecting a date in the CASV but the script managed to finish the scheduling! This is how it's supposed to look like, notice the two scheduled dates: Captura de Tela 2023-06-07 às 01 19 31

This is what the script managed to do: Captura de Tela 2023-06-07 às 01 14 13

Also, notice that the script failed to finish the scheduling but it scheduled the date successfully anyway: image

Do you have any idea what could have happened for this situation to take place?

Hi,
I am very busy doing other stuff. Also, there are too many emails to respond to. So, I'm sorry if I cannot respond to every issue like yours (at least on time). The current version, which you are using right now, is not the completed version of the Bot. I developed the bot during these few past months, but I didn't manage to document the code, and it will take a while to document the code and update the bot. In the new version, the ASC mode, which you are trying to use, is supported. I don't know if this CASV is the same as ASC or not. But I hope so. They are very similar in your images. The next feature in the bot update is the group mode which should be used in your situation. So, I know what these errors mean, but I cannot help you with them. Your problems need new features, and they will be solved with the next update of the bot. Till that moment, I hope you can find a way to solve this problem by yourself. I try my best to update the bot in a month or two. I cannot promise, but I try! I'm very sorry...

@exiett
Copy link

exiett commented Jun 8, 2023

Hi, I am very busy doing other stuff. Also, there are too many emails to respond to. So, I'm sorry if I cannot respond to every issue like yours (at least on time). The current version, which you are using right now, is not the completed version of the Bot. I developed the bot during these few past months, but I didn't manage to document the code, and it will take a while to document the code and update the bot. In the new version, the ASC mode, which you are trying to use, is supported. I don't know if this CASV is the same as ASC or not. But I hope so. They are very similar in your images. The next feature in the bot update is the group mode which should be used in your situation. So, I know what these errors mean, but I cannot help you with them. Your problems need new features, and they will be solved with the next update of the bot. Till that moment, I hope you can find a way to solve this problem by yourself. I try my best to update the bot in a month or two. I cannot promise, but I try! I'm very sorry...

No need to be sorry about, brother. I completely understand that this is a side project and you did amazing work on it. I'd like to also contribute to this pull request by updating the embassy.py file with the Brazilian embassies codes, here's what I've written:

# Embassy List
Embassies = {
    # [EMBASSY (COUNTRY CODE), FACILITY_ID (EMBASSY ID), "Continue in different languages"],
    "en-am-yer": ["en-am", 122, "Continue"], # English - Armenia - YEREVAN
    "es-co-bog": ["es-co", 25, "Continuar"], # Spanish - Colombia - Bogotá
    "en-ca-cal": ["en-ca", 89, "Continue"], # English - Canada - Calgary
    "en-ca-hal": ["en-ca", 90, "Continue"], # English - Canada - Halifax
    "en-ca-mon": ["en-ca", 91, "Continue"], # English - Canada - Montreal
    "en-ca-ott": ["en-ca", 92, "Continue"], # English - Canada - Ottawa
    "en-ca-que": ["en-ca", 93, "Continue"], # English - Canada - Quebec City
    "en-ca-tor": ["en-ca", 94, "Continue"], # English - Canada - Toronto
    "en-ca-van": ["en-ca", 95, "Continue"], # English - Canada - Vancouver
    "pt-br-sao": ["pt-br", 56, "Continuar"], # Portuguese - Brazil - São Paulo
    "pt-br-bsb": ["pt-br", 54, "Continuar"], # Portuguese - Brazil - Brasília
    "pt-br-poa": ["pt-br", 128, "Continuar"], # Portuguese - Brazil - Porto Alegre
    "pt-br-rec": ["pt-br", 57, "Continuar"], # Portuguese - Brazil - Recife
    "pt-br-rio": ["pt-br", 55, "Continuar"], # Portuguese - Brazil - Rio de Janeiro
}

As for the problem, yes, the ASC is the same as the CASV in Brazil. I'm pretty sure an update to the reschedule method including the ASC payload would solve the problem.

The bot keeps finding awesome dates, sometimes he even finds next week dates. My workaround was to keep monitoring the bot during the run and I've configured past dates in the config file, so when the script tries to compare the date he found with the date I've configured he doesn't attempt to reschedule and I do the rescheduling manually through the browser.

@deng-cy20
Copy link

I have got the same error as rescheduling failed, but sometimes it works well and successfully schedule the date. It's hard to debug......Apart from that, I have noticed that BAN_COOL_TIME could be set to 0. I have done experiments on that and noticed that people won't be punished for trying to get date under the situation of being banned. And sometimes you get empty list simply for the reason that there's no slot available. I'd like to contribute to this project and if there's any coding part you'd like assistance, please let me know! Thanks!
image

@jparagon23
Copy link

It is now working well, it is now a matter of thinking about not being banned, now retry time is more than 10 minutes, will cool down for 5 hours after 180 minutes, too short retry time will trigger the ban immediately after a few attempts. Given the 5-hour cooling-off period, I would assume that this would require at least 3 temporary accounts, taking turns to search for dates, and a retry time of no less than 10 minutes.

What is the correct time for not to be banned? I configured 10 to 20 minutes but in the 3 attempt I got the error "Break the loop after exception"

@jparagon23
Copy link

@Soroosh-N Before anything, thank you for your work into updating this script. My girlfriend got denied the visa in June 1st and the bot managed to schedule the new one we issue on the 12th of the same month (next monday).

Although, I'd like to check with you if the script can handle the second mandatory scheduling on the CASV (Centro de Assistência ao Solicitante de Visto, from Portuguese, Center of Assistant to the Visa Applicant). In certain Brazilian consulates, the applicant must go first through the CASV to collect biometry and take the visa picture and then head to the interview at the Embassy. I'm not sure how this screen appears to you in different embassies websites but this is how it looks like in the Brazilian site: Captura de Tela 2023-06-07 às 01 09 30

The most interesting in this situation is that an user cannot finish the process of scheduling the interview in the embassy without before selecting a date in the CASV but the script managed to finish the scheduling! This is how it's supposed to look like, notice the two scheduled dates: Captura de Tela 2023-06-07 às 01 19 31

This is what the script managed to do: Captura de Tela 2023-06-07 às 01 14 13

Also, notice that the script failed to finish the scheduling but it scheduled the date successfully anyway: image

Do you have any idea what could have happened for this situation to take place?

were you finally able to schedule the CAS appointment?

@xwshiba
Copy link

xwshiba commented Jun 19, 2023

Hi @Soroosh-N,
Thank you so much for updating the script. Also, I appreciate you updating the README.md as well. It is a pleasure to read excellent documentation.

I would like to point out one thing when using the script for any Mac M1 users - the webdriver-manager package 3.7.0 is not working well in terms of getting the latest chrome web driver.

If you have encountered similar issues as me, try using pip install webdriver-manager==3.8.6, which is the latest webdriver-manager version. It will resolve this problem.

@etomak1228
Copy link

Hi,

I would like to know how set up this feature.

Multi-account support (switching between accounts in Resting times)

@vikas4840
Copy link

Is there a way to send notification to telegram? Can someone modify the visa.py file with that code please?

@ndemirci
Copy link

ndemirci commented Nov 1, 2023

Hi @Soroosh-N, I am using your version of visa.py and this is my 3rd or 4th day in this. I am not a coding guy but I have to find a solution for my visa application. I have a trouble and I would be appreciated if you may guide me through. Last day it was the first time bot can find a day for me and said "got the time successfully" also send me notification as "break the loop after exception!". However I checked my account and appoinment was not rescheculed. Also when i am writing this it found another and said got time successfully but again it could not make it. How can i fix it, certainly it can find a date but can not reschedule automatically??

image image

@Ali-Flt
Copy link

Ali-Flt commented Dec 27, 2023

Hey guys. Does anyone know what is a good retry interval and work limit time to minimize getting banned? Also someone mentioned that you can still check for the date even after getting banned and you don't get punished. Is that true?

@squall1207
Copy link

Hi @Soroosh-N , I am using your script, thank you very much. I wonder whether the script support group reschedulement. It seems that it does not work correclty. Could you give some hints for me to solve it?

@Ali-Flt
Copy link

Ali-Flt commented Jan 27, 2024

@squall1207 check out my repo. I used the code from another more up to date visa rescheduler and I believe it works with groups too. With that said, I think the chances of finding more than one cancelled appointment at a certain time and date are pretty low.

https://github.com/Ali-Flt/us_visa_rescheduler

@KaanTopalx
Copy link

Hello @Soroosh-N ,

Thanks for your nice coding.
I would like to ask for ; Is that possible to check 2 embassies at the same time.
In my location there are 2 embassies for appoinment but couldn't find a way to check for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.