Transfer Wishlist to other account - save wishlist (tool)

Programador
by Programador · 16 posts
1 year ago in Python
Posted 1 year ago · Author
Hello guys. As described in the title, i needed to save my wishlist on imvu, but I couldn't find anything that could help me. So I ended up making this "tool", or rather... This program that you can run it, log into the fake account and save all the items that are on your list, I hope this helps in some way...

I have no intention of continuing this little project, because the way it is now, serves me very well...

But I'll leave the source code so you can do something if you want. Feel free to do whatever you want.

ps: I don't know much about python, so I had a lot of help from gpt-3 xD

source-code (python):

Code
# Import necessary modules
import builtins
import easygui
import json
import re
import time
from typing import List
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException

# Define custom input function to use easygui
def input(prompt=''):
    return easygui.enterbox(prompt)

# Replace built-in input function with custom input function
builtins.input = input

# Define function to get login information from user
def get_login_info() -> tuple:
    username = input("Digite seu nome de usuário: ")
    password = input("Digite sua senha: ")
    cid = input("Digite o CID: ")
    return username, password, cid

# Define function to log-in
def login(driver: webdriver.Chrome, login_url: str, username: str, password: str) -> None:
    # Load the login page URL
    driver.get(login_url)
   
    # Wait until the sign-in button is present on the page
    WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "sign-in")))
   
    # Find the sign-in button element and click it
    login_button = driver.find_element(By.CLASS_NAME, "sign-in")
    login_button.click()
   
    # Wait for 3 seconds for the page to load
    time.sleep(3)
   
    # Find the username input element and enter the username
    username_input = driver.find_element(By.NAME, "avatarname")
    username_input.send_keys(username)
   
    # Find the password input element and enter the password
    password_input = driver.find_element(By.NAME, "password")
    password_input.send_keys(password)
   
    # Submit the login form by pressing the Enter key on the keyboard
    password_input.send_keys(Keys.ENTER)

    # Wait for 5 seconds for the login process to complete
    time.sleep(5)



def extract_wishlist_ids(driver: webdriver.Chrome, cid: str) -> List[str]:
    # Access the wishlist API endpoint for the user with the given cid
    driver.get(f"https://api.imvu.com/user/user-{cid}/wishlist?start_index=1&limit=900")
   
    # Wait for the page to load before accessing the response
    time.sleep(5)
   
    # Find the response element on the page and extract its text
    response = driver.find_element(By.TAG_NAME, "pre")
    response_json = json.loads(response.text)
   
    # Wait for the page to finish processing before continuing
    time.sleep(5)
   
    # Extract the wishlist ids from the response JSON
    wishlist_ids = set()
    for resp in response_json["denormalized"]:
        match = re.search(r"product-(\d+)", resp)
        if match:
            wishlist_ids.add(match.group(1))
   
    # Return the set of wishlist ids
    return wishlist_ids


def add_to_wishlist(driver: webdriver.Chrome, product_id: str) -> None:
    # go to the product page
    driver.get(f"https://pt.imvu.com/shop/product.php?products_id={product_id}")
    time.sleep(1)
    try:
        # get the product name
        product_name = driver.find_element(By.CSS_SELECTOR,"h1.notranslate").text
        # find the 'Add to Wishlist' button
        add_to_wishlist_button = driver.find_element(By.CSS_SELECTOR,"a#add-to-wishlist")
        # ask user if they want to add the item to wishlist
        choice = easygui.buttonbox(f"Do you want to save {product_name} to your wishlist?", choices=["Yes", "No"])
        if choice == "Yes":
            # click the 'Add to Wishlist' button
            add_to_wishlist_button.click()
            print(f"Item {product_name} added to wishlist")
            return True
        else:
            print(f"Item {product_name} not added to wishlist")
            return False
    except NoSuchElementException:
        # if the product is not found
        print(f"Item {product_id} not found. Moving on to the next item.")
        return False


def add_to_wishlist_no_button_box(driver: webdriver.Chrome, product_id: str) -> None:
    # Navigate to the product page
    driver.get(f"https://pt.imvu.com/shop/product.php?products_id={product_id}")
    time.sleep(1)
    try:
        # Get the name of the product
        product_name = driver.find_element(By.CSS_SELECTOR, "h1.notranslate").text
        # Click the "Add to Wishlist" button
        add_to_wishlist_button = driver.find_element(By.CSS_SELECTOR, "a#add-to-wishlist")
        add_to_wishlist_button.click()
        # Print a success message
        print(f"Item {product_name} added to wishlist")
        return True
   
    except NoSuchElementException:
        # Print an error message if the product is not found
        print(f"Item {product_id} not found. Moving on to the next item.")
        return False



def main():
    # Login page URL
    login_url = "https://secure.imvu.com/welcome/login/"

    # Get login information
    username, password, cid = get_login_info()

    # Configure Google Chrome webdriver settings
    options = Options()
    options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
    options.add_argument("--start-maximized")
    driver = webdriver.Chrome(options=options)

    # Log in
    login(driver, login_url, username, password)

    # Extract wishlist IDs
    wishlist_ids = extract_wishlist_ids(driver, cid)

    # Ask user if they want to save all items without showing a confirmation box
    save_all = easygui.ynbox("Do you want to save all items without showing a confirmation box?", "Save all items")

    # Loop through each item in the wishlist and add it to the user's wishlist
    founded = 0  # Number of items successfully added to wishlist
    not_founded = 0  # Number of items that could not be added to wishlist
    for product_id in wishlist_ids:
        if not save_all:
            # Ask the user if they want to add the current item to their wishlist
            if add_to_wishlist(driver, product_id):
                founded += 1
            else:
                not_founded += 1
        else:
            # Add the current item to the wishlist without asking for confirmation
            if add_to_wishlist_no_button_box(driver, product_id):
                founded += 1
            else:
                not_founded += 1

        # Wait for 1 second before processing the next item in the wishlist
        time.sleep(1)
       
    # Print the number of items that were successfully added and those that could not be added
    print(f"{founded} items were added to the wishlist, and {not_founded} items could not be added.")

    # Wait 20 seconds after all
    time.sleep(20)

    # say goodbye baby
    driver.quit()


if __name__ == "__main__":
    main()




Below is the program compiled with pyinstaller, just run it and put the necessary information. Remembering that there is no error handling when placing the information, so... if you make a mistake, the code will return errors.

saveWishlistRar.rar
Posted 1 year ago
@Tooly


He's not a programmer. He had an AI write this for him. Thus the 33mb size and overuse of complex libraries for such a simple program. Blame the AI for using a tank to break out of a paper bag. AI come up with some complex banana solutions. It works though and still helps the community that he shared it. I've been saying we needed a wishlist backup program for years. :wrench: Good to see someone got it done and shared it.

I wish we had software for backing up inventory and outfits as well.

We already have software for backing up messages and friends lists.
Posted 1 year ago
antivirus saying suspecious file detected
Posted 1 year ago
Looks nice. Next time u'r looking into automating tools on IMVU, the process is less painful by going thru IMVU's api. Gives out a JSON response, and this makes the job easier, and is a cleaner approach doing so. If on demand for higher requests, VPN is advised if u'r doing a lot of requests, not too different country, sessions tend to expire here and then, and faulty geolocation at authentication might disable your account.

But, in this way u will have to filter less, not launch any browser processes and click additional buttons. Makes the job easier for you.

    Makes the code faster
    Cleans it up and makes it a lot shorter.
    No need of Python Selenium or other browser driven tools. You can wrap it up in your own nice CLI or GUI through the use of a simple login system made available by the api.

api.imvu.com is the place to look.

If u use Python, I recommend using requests.Session, this way u can initialize your requests one time (copy) and reuse it as a reference to that, this will also speed up the code.
Posted 1 year ago
@Don Von Alpha Dom


What does that work for ?
Posted 1 year ago
still donno how to use this can someone make youtube tutorial on how to use these python tool , there lot script vaiable in this platform donno how to use i have installed phython donno how to excute them to make them work to use

-- Wed Jul 19, 2023 6:24 pm --

can someone make this script to download all picture of imvu albums i think people wanted to save those picture then wislist ,if this wishlist same as this wislist downloader albums downloader would be nice

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT