$ chromedriver --version
ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875})
$ google-chrome-stable --version
Google Chrome 99.0.4844.51
#!/usr/bin/env bash
while IFS= read -r -d '' file; do
file_name=$(basename "$file" | cut -d "." -f 1)
target_dir="/config/rec/$file_name"
mkdir -p "$target_dir"
cp "$file" "$target_dir"
rclone copy "$target_dir" cloud: --max-age 12h --create-empty-src-dirs -P --transfers=1 --checkers=1;
done < <(find "$DIR" -name "*.mp4" -print0)
rclone
я не пользуюсь, так что сами проверьте эту часть. import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from bs4 import BeautifulSoup
options = Options()
options.headless = True
driver = webdriver.Chrome(options=options)
URL = 'https://eth.nanopool.org/'
driver.get(URL)
html = driver.page_source
time.sleep(5)
soup = BeautifulSoup(html, 'lxml')
data = soup.find_all('div', class_='panel panel-primary fixed-height-panel')
for elem in data:
elem_title = elem.find('div', class_='panel-title').text
elem_value = elem.find('div', class_='panel-body').text
print(f'{elem_title}: {elem_value}')
Result: near "BETWEEN": syntax error
from bs4 import BeautifulSoup
DOC = '''
<html>
<body>
<div>
<p class="1">
<label>Значение, которое нужно спарсить</label>
</div>
<div>
<p class="2">
<label>Значение, которое мне не нужно</label>
</div>
<div>
<p class="1">
<label>Ещё одно значение, которое нужно спарсить</label>
</div>
</body>
</html>
'''
soup = BeautifulSoup(DOC, 'lxml')
for par in soup.find_all('p', class_='1'):
label = par.find_parent('div').find('label')
print(label.text)
import sys
from bs4 import BeautifulSoup
DOC = 'test.html'
try:
with open(DOC, encoding='utf-8') as f:
page = f.read()
except IOError as err:
print(f'Error reading the file {DOC}: {err}')
sys.exit()
soup = BeautifulSoup(page, 'lxml')
rows = soup.find_all('tr')
rows = [row.find_all('td') for row in rows]
rows = [row for row in rows if row]
for row in rows:
columns = [cell.text.strip() for cell in row]
columns = [cell for cell in columns if cell]
print(f'{columns[0]}:', *columns[1:-1], f'Ср: {columns[-1]}')