async function scrollAndExecute() {
while (true) {
let center_block = document.querySelector(...);
func();
center_block.scrollBy(0, 100);
await new Promise(resolve => setTimeout(resolve, 100));
if (center_block.scrollHeight <= center_block.scrollTop + center_block.clientHeight) {
break;
}
}
}
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<a class="navbar-brand" href="#"><img src="isset/img/logo.png" /></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#section1">Section 1</a>
</li>
<!-- ну твои элементы тут -->
</ul>
</div>
<button class="btn csmButtom d-block mx-auto text-center" data-toggle="modal" data-target="#myModal">ЗАПИСАТЬСЯ</button>
</nav>
import pyautogui as pg
import time as tm
with open("pos.txt") as file:
for line in file:
posX, posY = line.strip().split(":")
posX, posY = int(posX), int(posY)
pg.moveTo(posX, posY, duration=1)
tm.sleep(1)
pg.click()
const reversedData = jsonData.data.reverse();
console.log(reversedData);
// добавление новой записи
const newEntry = {
"id": 1,
"title": "Новый заголовок",
"content": "Новая запись",
"tags": ["юр", "новый_тег"]
};
jsonData.data.push(newEntry);
console.log(jsonData.data);
// поиск по тегам
function getEntriesByTag(tag) {
return jsonData.data.filter(entry => entry.tags.includes(tag));
}
const tag = "юр";
const entriesWithTag = getEntriesByTag(tag);
console.log(entriesWithTag);
// удаление по index, но учти, что это index записи, пример правильный записи выше, и правильно тебе сказали выше, что нужно хранить id в самой записи
function deleteEntryById(id) {
const indexToDelete = jsonData.data.findIndex(entry => entry.id === id);
if (indexToDelete !== -1) {
jsonData.data.splice(indexToDelete, 1);
}
}
const idToDelete = 1;
deleteEntryById(idToDelete);
console.log(jsonData.data);
from docx import Document
merged_doc = Document()
file_names = ["file1.docx", "file2.docx", "file3.docx"]
for file_name in file_names:
doc = Document(file_name)
for element in doc.element.body:
if isinstance(element, docx.oxml.table.CT_Tbl):
new_table = merged_doc.add_table(rows=0, cols=len(element[0]))
for row in element:
new_row = new_table.add_row().cells
for i, cell in enumerate(row):
new_row[i].text = cell.text
else:
merged_doc.element.body.append(element)
if file_name != file_names[-1]:
merged_doc.add_page_break()
merged_doc.save("merged.docx")
pip install selenium-wire
import random, fake_useragent
from typing import List
from settings import settings
from seleniumwire import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
import seleniumwire.undetected_chromedriver as uc
def get_connect_with_random_proxy() -> webdriver.Chrome:
options: Options = Options()
options.add_argument("--log-level=3")
options.add_argument(f'user-agent={fake_useragent.UserAgent().random}')
proxylist: List[str] = open(settings.config['proxy_file'], 'r').read().splitlines()
proxy: str = random.choice(proxylist)
proxy_parts: List[str] = proxy.split(':')
proxy_address: str = proxy_parts[0]
proxy_port: int = int(proxy_parts[1])
proxy_username: str = proxy_parts[2]
proxy_password: str = proxy_parts[3]
proxy_options = {
'proxy': {
'http': f'http://{proxy_username}:{proxy_password}@{proxy_address}:{proxy_port}',
'https': f'https://{proxy_username}:{proxy_password}@{proxy_address}:{proxy_port}',
'no_proxy': None,
}
}
driver: webdriver.Chrome = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options = options, seleniumwire_options = proxy_options)
return driver