Автоматическое выставление цен на сминченную коллекцию

admin

Administrator
Команда форума
Python:
# First install Chrome, and the Selenium driver
# Next, download and save the MetaMask CRX (there are plenty of guides on how to do this)

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time

# The first time you do this, you'll need to connect your metamask wallet
# Leave the browser open with only one tab
op = Options()
op.add_extension('metamask.crx')  # <-- route to the CRX file
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)

#path = '/usr/local/bin/chromedriver'
#driver = webdriver.Chrome(executable_path=path)


chain = 'matic' # Change for other chains, but if you're using other chains just use the API instead
# Pull this from the URL of your collection
collection_address = 'address'
price = '0.002' # must be a string

def list(i):
        # Main window
        chrome.switch_to.window(chrome.window_handles[0])
        # Go to sale page
        chrome.get('https://opensea.io/assets/{}/{}/{}/sell'.format(chain, collection_address, i))
        # Check that it isn't already for sale - nevermind it just lists it again
        
        # Set price
        for i in range(500): # See if it's there
            try:
                chrome.find_element(By.XPATH, '//input[@name="price"]')
                break
            except:
                time.sleep(0.5)
                
        chrome.find_element(By.XPATH, '//input[@name="price"]').send_keys(price + Keys.RETURN)
        
        # Click sign
        for i in range(500):
            try:
                chrome.find_element(By.XPATH, '//button[text()="Sign"]')
                break
            except:
                time.sleep(0.5)
                
        chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()
        
        # Switch to new window
        time.sleep(1)
        chrome.switch_to.window(chrome.window_handles[1])
        
        # Click sign
        for i in range(50):
            try:
                chrome.find_element(By.XPATH, '//button[text()="Sign"]')
                break
            except:
                time.sleep(0.5)
        
        chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()
        
start = int(input("Start index (included): "))
end = int(input("End index (included): "))

for i in range(start, end+1):
    list(i)
    
print("Ended listing")
 

noname

New member
А как сделать, что бы скрипт выставлял время продажи не на 7 дней, а на 6 месяцев
Python:
# First install Chrome, and the Selenium driver
# Next, download and save the MetaMask CRX (there are plenty of guides on how to do this)

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time

# The first time you do this, you'll need to connect your metamask wallet
# Leave the browser open with only one tab
op = Options()
op.add_extension('metamask.crx')  # <-- route to the CRX file
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)

#path = '/usr/local/bin/chromedriver'
#driver = webdriver.Chrome(executable_path=path)


chain = 'matic' # Change for other chains, but if you're using other chains just use the API instead
# Pull this from the URL of your collection
collection_address = 'address'
price = '0.002' # must be a string

def list(i):
        # Main window
        chrome.switch_to.window(chrome.window_handles[0])
        # Go to sale page
        chrome.get('https://opensea.io/assets/{}/{}/{}/sell'.format(chain, collection_address, i))
        # Check that it isn't already for sale - nevermind it just lists it again
       
        # Set price
        for i in range(500): # See if it's there
            try:
                chrome.find_element(By.XPATH, '//input[@name="price"]')
                break
            except:
                time.sleep(0.5)
               
        chrome.find_element(By.XPATH, '//input[@name="price"]').send_keys(price + Keys.RETURN)
       
        # Click sign
        for i in range(500):
            try:
                chrome.find_element(By.XPATH, '//button[text()="Sign"]')
                break
            except:
                time.sleep(0.5)
               
        chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()
       
        # Switch to new window
        time.sleep(1)
        chrome.switch_to.window(chrome.window_handles[1])
       
        # Click sign
        for i in range(50):
            try:
                chrome.find_element(By.XPATH, '//button[text()="Sign"]')
                break
            except:
                time.sleep(0.5)
       
        chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()
       
start = int(input("Start index (included): "))
end = int(input("End index (included): "))

for i in range(start, end+1):
    list(i)
   
print("Ended listing")
А как сделать так, что бы скрипт выставлял время продажи не 7 дней, а 6 месяцев?
 

Alex_extream

New member
Скрипт при подтверждении продажи в метамаске, не прогручивает транзакцию до активации кнопки.
 

totoro

New member
Чтобы не менять язык в кошельке, можно при старте браузера указать английский язык самого браузера
Код:
op.add_experimental_option('prefs', {'intl.accept_languages': 'en-US'})
Да и искать по лэйбам кнопок действительно не кошерно, как и 500 раз пытаться проверять доступен ли элемент, а потом кликать на него. Надежнее всего использовать WebDriverWait и expected_conditions, ну или хотя бы Implicit wait
 

totoro

New member
А как сделать так, что бы скрипт выставлял время продажи не 7 дней, а 6 месяцев?

дописать в импортах
from selenium.webdriver.support.ui import Select

и после ввода цены добавить
select = Select(browser.find_element_by_tag_name("<имя_тэга>"))
select.select_by_index(<индекс_нужного_элемента_в_дропдауне>)
 

kolobok

New member
дописать в импортах
from selenium.webdriver.support.ui import Select

и после ввода цены добавить
select = Select(browser.find_element_by_tag_name("<имя_тэга>"))
select.select_by_index(<индекс_нужного_элемента_в_дропдауне>)
покажи как это сделать если не сложно тг : https://t.me/dogymoons
 

HVPE

New member
Всем привет. Попытался я через XPATH обойти как-то прокручивание подтверждения транзакции, но, увы не смог. Кто-нибудь смог решить данную проблему?
 

bukraz

New member
За пару часов настроил так, что и метамаск весь заполняется сам, и авторизация сама, но пришлось покумекать

Кто не справился со скроллом :
Код:
# прокручиваем
chrome.find_element(By.XPATH, '//div[@data-testid="signature-request-scroll-button"]').click()
# ждем разблокировки кнопки
time.sleep(1)
#подписываем
chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()
 

bukraz

New member
Скрипт при подтверждении продажи в метамаске, не прогручивает транзакцию до активации кнопки.
Всем привет. Попытался я через XPATH обойти как-то прокручивание подтверждения транзакции, но, увы не смог. Кто-нибудь смог решить данную проблему?
Смотрите выше
 

HVPE

New member
За пару часов настроил так, что и метамаск весь заполняется сам, и авторизация сама, но пришлось покумекать

Кто не справился со скроллом :
Код:
# прокручиваем
chrome.find_element(By.XPATH, '//div[@data-testid="signature-request-scroll-button"]').click()
# ждем разблокировки кнопки
time.sleep(1)
#подписываем
chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()
Не работает, можешь пожалуйста скинуть полный код, вроде всё куда надо выставил.
 

HVPE

New member
# First install Chrome, and the Selenium driver
# Next, download and save the MetaMask CRX (there are plenty of guides on how to do this)
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
# The first time you do this, you'll need to connect your metamask wallet
# Leave the browser open with only one tab
op = webdriver.ChromeOptions()
op.add_extension('metamask.crx') # <-- route to the CRX file
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)



#path = '/usr/local/bin/chromedriver'
#driver = webdriver.Chrome(executable_path=path)

chain = 'matic' # Change for other chains, but if you're using other chains just use the API instead
# Pull this from the URL of your collection
collection_address = ''
price = '' # must be a string
def list(i):
# Main windowsssssss
chrome.switch_to.window(chrome.window_handles[0])
# Go to sale page
chrome.get('https://opensea.io/assets/{}/{}/{}/sell'.format(chain, collection_address, i))
# Check that it isn't already for sale - nevermind it just lists it again

# Set price
for i in range(10): # See if it's there
try:
chrome.find_element(By.XPATH, '//input[@name="price"]')
break
except:
time.sleep(0.5)

chrome.find_element(By.XPATH, '//input[@name="price"]').send_keys(price + Keys.RETURN)

# Click sign
for i in range(10):
try:
chrome.find_element(By.XPATH, '//button[text()="Sign"]')
break
except:
time.sleep(0.5)

chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()

# прокручиваем
chrome.find_element(By.XPATH, '//div[@data-testid="signature-request-scroll-button"]').click()
# ждем разблокировки кнопки
time.sleep(1)
#подписываем
chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()

# Switch to new window
time.sleep(0.5)
chrome.switch_to.window(chrome.window_handles[1])

# Click sign
for i in range(10):
try:
chrome.find_element(By.XPATH, '//button[text()="Sign"]')
break
except:
time.sleep(0.5)

chrome.find_element(By.XPATH, '//button[text()="Sign"]').click()

start = int(input("Start index (included): "))
end = int(input("End index (included): "))
for i in range(start, end+1):
list(i)

print("Ended listing")
 

HVPE

New member
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@data-testid="signature-request-scroll-button"]"}
 

Alex1998

New member
Здравствуйте, помогите пожалуйста!
при запуске команды браузер открывается, все запускается, но как только перехожу обратно в VS Code, что бы вписать цифру с какой начитать выставление цен, то выбивает такое:

====== WebDriver manager ======
Current google-chrome version is 100.0.4896
Get LATEST chromedriver version for 100.0.4896 google-chrome
Driver [C:\Users\admin\.wdm\drivers\chromedriver\win32\100.0.4896.60\chromedriver.exe] found in cache
C:\Users\admin\Desktop\nft\nft.py:15: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)

DevTools listening on ws://127.0.0.1:62835/devtools/browser/648533b3-6d8b-4269-bfa0-fa111022ce76
[3676:5352:0424/193247.604:ERROR:device_event_log_impl.cc(214)] [19:32:47.604] Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed.
[3676:5352:0424/193247.605:ERROR:device_event_log_impl.cc(214)] [19:32:47.605] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: ╧Ёшёюхфшэхээюх ъ ёшёЄхьх єёЄЁющёЄтю эх ЁрсюЄрхЄ. (0x1F)
[3676:5352:0424/193247.606:ERROR:usb_descriptors.cc(117)] Failed to read configuration descriptor.
[3676:5352:0424/193247.606:ERROR:usb_descriptors.cc(100)] Failed to read all configuration descriptors. Expected 1, got 0.
[3676:5352:0424/193247.607:ERROR:device_event_log_impl.cc(214)] [19:32:47.607] USB: usb_device_win.cc:96 Failed to read descriptors from \\?\usb#vid_275d&pid_0ba6#5&42f4ab9&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}.
Traceback (most recent call last):
File "C:\Users\admin\Desktop\nft\nft.py", line 15, in <module>
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 269, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 360, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 425, in execute
self.error_handler.check_response(response)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: failed to wait for extension background page to load: chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.html
from timeout: Timed out receiving message from renderer: 10.000
Stacktrace:
Backtrace:
Ordinal0 [0x00957413+2389011]
Ordinal0 [0x008E9F61+1941345]
Ordinal0 [0x007DC658+837208]
Ordinal0 [0x007CDB80+777088]
Ordinal0 [0x007CC995+772501]
Ordinal0 [0x007CCF98+774040]
Ordinal0 [0x007D796F+817519]
Ordinal0 [0x007E243B+861243]
Ordinal0 [0x007E4E10+871952]
Ordinal0 [0x007CD266+774758]
Ordinal0 [0x007E2077+860279]
Ordinal0 [0x007C2A3D+731709]
Ordinal0 [0x007F88D0+952528]
Ordinal0 [0x007F5C51+941137]
Ordinal0 [0x00828C80+1150080]
Ordinal0 [0x008288DA+1149146]
Ordinal0 [0x00823F66+1130342]
Ordinal0 [0x007FE546+976198]
Ordinal0 [0x007FF456+980054]
GetHandleVerifier [0x00B09632+1727522]
GetHandleVerifier [0x00BBBA4D+2457661]
GetHandleVerifier [0x009EEB81+569713]
GetHandleVerifier [0x009EDD76+566118]
Ordinal0 [0x008F0B2B+1968939]
Ordinal0 [0x008F5988+1989000]
Ordinal0 [0x008F5A75+1989237]
Ordinal0 [0x008FECB1+2026673]
BaseThreadInitThunk [0x76F4CFC9+25]
RtlExpandEnvironmentStrings_U [0x770126B5+917]
RtlExpandEnvironmentStrings_U [0x77012689+873]

PS C:\Users\admin\Desktop\nft> [3676:6700:0424/193344.197:ERROR:util.cc(126)] Can't create base directory: C:\Program Files\Google\GoogleUpdater
[7052:9456:0424/193442.545:ERROR:gpu_init.cc(446)] Passthrough is not supported, GL is disabled, ANGLE is
 

totoro

New member
Здравствуйте, помогите пожалуйста!
при запуске команды браузер открывается, все запускается, но как только перехожу обратно в VS Code, что бы вписать цифру с какой начитать выставление цен, то выбивает такое:

====== WebDriver manager ======
Current google-chrome version is 100.0.4896
Get LATEST chromedriver version for 100.0.4896 google-chrome
Driver [C:\Users\admin\.wdm\drivers\chromedriver\win32\100.0.4896.60\chromedriver.exe] found in cache
C:\Users\admin\Desktop\nft\nft.py:15: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)

DevTools listening on ws://127.0.0.1:62835/devtools/browser/648533b3-6d8b-4269-bfa0-fa111022ce76
[3676:5352:0424/193247.604:ERROR:device_event_log_impl.cc(214)] [19:32:47.604] Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed.
[3676:5352:0424/193247.605:ERROR:device_event_log_impl.cc(214)] [19:32:47.605] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: ╧Ёшёюхфшэхээюх ъ ёшёЄхьх єёЄЁющёЄтю эх ЁрсюЄрхЄ. (0x1F)
[3676:5352:0424/193247.606:ERROR:usb_descriptors.cc(117)] Failed to read configuration descriptor.
[3676:5352:0424/193247.606:ERROR:usb_descriptors.cc(100)] Failed to read all configuration descriptors. Expected 1, got 0.
[3676:5352:0424/193247.607:ERROR:device_event_log_impl.cc(214)] [19:32:47.607] USB: usb_device_win.cc:96 Failed to read descriptors from \\?\usb#vid_275d&pid_0ba6#5&42f4ab9&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}.
Traceback (most recent call last):
File "C:\Users\admin\Desktop\nft\nft.py", line 15, in <module>
chrome = webdriver.Chrome(ChromeDriverManager().install(), options=op)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 269, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 360, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 425, in execute
self.error_handler.check_response(response)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: failed to wait for extension background page to load: chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.html
from timeout: Timed out receiving message from renderer: 10.000
Stacktrace:
Backtrace:
Ordinal0 [0x00957413+2389011]
Ordinal0 [0x008E9F61+1941345]
Ordinal0 [0x007DC658+837208]
Ordinal0 [0x007CDB80+777088]
Ordinal0 [0x007CC995+772501]
Ordinal0 [0x007CCF98+774040]
Ordinal0 [0x007D796F+817519]
Ordinal0 [0x007E243B+861243]
Ordinal0 [0x007E4E10+871952]
Ordinal0 [0x007CD266+774758]
Ordinal0 [0x007E2077+860279]
Ordinal0 [0x007C2A3D+731709]
Ordinal0 [0x007F88D0+952528]
Ordinal0 [0x007F5C51+941137]
Ordinal0 [0x00828C80+1150080]
Ordinal0 [0x008288DA+1149146]
Ordinal0 [0x00823F66+1130342]
Ordinal0 [0x007FE546+976198]
Ordinal0 [0x007FF456+980054]
GetHandleVerifier [0x00B09632+1727522]
GetHandleVerifier [0x00BBBA4D+2457661]
GetHandleVerifier [0x009EEB81+569713]
GetHandleVerifier [0x009EDD76+566118]
Ordinal0 [0x008F0B2B+1968939]
Ordinal0 [0x008F5988+1989000]
Ordinal0 [0x008F5A75+1989237]
Ordinal0 [0x008FECB1+2026673]
BaseThreadInitThunk [0x76F4CFC9+25]
RtlExpandEnvironmentStrings_U [0x770126B5+917]
RtlExpandEnvironmentStrings_U [0x77012689+873]

PS C:\Users\admin\Desktop\nft> [3676:6700:0424/193344.197:ERROR:util.cc(126)] Can't create base directory: C:\Program Files\Google\GoogleUpdater
[7052:9456:0424/193442.545:ERROR:gpu_init.cc(446)] Passthrough is not supported, GL is disabled, ANGLE is
а если так?

Python:
# First install Chrome, and the Selenium driver
# Next, download and save the MetaMask CRX (there are plenty of guides on how to do this)

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time

# The first time you do this, you'll need to connect your metamask wallet
# Leave the browser open with only one tab
op = Options()
op.add_experimental_option('prefs', {'intl.accept_languages': 'en-US'})
op.add_extension('MetaMask.crx')  # <-- route to the CRX file
chrome = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=op)
 

Alex1998

New member
а если так?

Python:
# First install Chrome, and the Selenium driver
# Next, download and save the MetaMask CRX (there are plenty of guides on how to do this)

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time

# The first time you do this, you'll need to connect your metamask wallet
# Leave the browser open with only one tab
op = Options()
op.add_experimental_option('prefs', {'intl.accept_languages': 'en-US'})
op.add_extension('MetaMask.crx')  # <-- route to the CRX file
chrome = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=op)
Все так же, как и было
 

limarkximus

New member
скрипт проходит 1 круг и останавливается(( кто знает как поправить? чтобы цикл не прерывался?
 
Сверху