Почему переменная all_participants принимает только 10000 значений, а не больше при парсинге?
// wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/js/slick.min.js', array(jquery), 'null', true );
wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/js/slick.min.js', array('jquery'), null, true );
// wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/js/slick.js', array(jquery), 'null', true );
wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/js/slick.min.js', array(jquery), 'null', true );
<?php
add_action('wp_enqueue_scripts', function () {
// styles
wp_enqueue_style('style', get_template_directory_uri() . '/assets/css/style.css');
wp_enqueue_style('media', get_template_directory_uri() . '/assets/css/media.css');
wp_enqueue_style('slick-style', get_template_directory_uri() . '/assets/css/slick.css');
// jquery
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js', [], null, true);
wp_enqueue_script('jquery');
// scripts
wp_enqueue_script('slick', get_template_directory_uri() . '/assets/js/slick.min.js', ['jquery'], null, true);
wp_enqueue_script('main', get_template_directory_uri() . '/assets/js/main.js', ['jquery'], null, true);
});
add_theme_support('post-thumbnails');
add_theme_support('title-tag');
add_theme_support('custom-logo');
?>
lst = []
while True:
item = input('Введите 6-значное число: ')
if len(item) != 6:
break
lst.append(int(item))
# sorting
lst.sort()
prev = None
for num in lst:
nums = str(num)[:3] # first 3 numbers
if nums != prev:
print() # print empty row
prev = nums
print(num, end=' ')
а если запустить цикл повторно, файл в котором хранятся просмотренные фильмы перезаписывается
with open('iwatch.txt', 'w', encoding='utf-8') as f:
with open('iwatch.txt', 'a', encoding='utf-8') as f:
import random
import json
# file
try:
with open('films.json', 'r', encoding='utf-8') as f:
films = json.load(f)
except FileNotFoundError:
films = {}
# save
def save(films):
with open('films.json', 'w', encoding='utf-8') as f:
json.dump(films, f, ensure_ascii=False, indent=4)
# main
def main():
while True:
random_film_key = random.choice(list(films))
film_value = films.get(random_film_key).replace(',', '\n')
print("Фильм: " + random_film_key, "Описание фильма: " + film_value, sep='\n')
# а где вариант 3 (ya est' Grut)?
q = input("Ты смотрел этот фильм? да - 1, нет - 0, выход - любая другая клавиша \n")
if q == '1':
with open('iwatch.txt', 'a', encoding='utf-8') as f:
f.write(random_film_key + '\n')
del films[random_film_key]
save(films)
elif q == '0':
continue
else:
break
# run
main()
Если не сложно, добавьте пример самого графика. Как добавить туда значения - я как-нибудь доковыляю сам.
То есть надо было сначала спарсить семантическое ядро у конкурентов, кластеризировать, и, исходя из этого, делать стуктуру.
В связи с этим есть вопрос: целесообразно и возможно ли переделать всю структуру сайта? У страниц же будут другие адреса, будет путаница в индексации и множество ошибок.
Или проще сделать новый сайт на новом домене?
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.6.0/axios.min.js" integrity="sha512-WrdC3CE9vf1nBf58JHepuWT4x24uTacky9fuzw2g/3L9JkihgwZ6Cfv+JGTtNyosOhEmttMtEZ6H3qJWfI7gIQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cheerio/0.22.0/index.js" integrity="sha512-+obmGUxyA+OfXW4RU7Ez2JBbCFy+dmZatW/Z5u/PDZlY+SKzAMSHzpNfTDohw7RFfW+zmLrI9h19XiODWZRO5A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
const parse = async () => {
const getHTML = async (url) => {
const { data } = await axios.get(url);
return cheerio.load(data);
};
const $ = await getHTML("https://rozetka.com.ua/search/?text=%D0%B7%D0%B0%D1%80%D1%8F%D0%B4%D0%BD%D0%B0+%D1%81%D1%82%D0%B0%D0%BD%D1%86%D1%96%D1%8F§ion_id=4674585");
const pageNumber = parseInt($('a.pagination__link').eq(-1).text());
for (let i = 1; i <= pageNumber; i++) { // Виправлено умову циклу
const selector = await getHTML(
`https://rozetka.com.ua/search/?text=%D0%B7%D0%B0%D1%80%D1%8F%D0%B4%D0%BD%D0%B0+%D1%81%D1%82%D0%B0%D0%BD%D1%86%D1%96%D1%8F§ion_id=4674585&page=${i}` // Виправлено номер сторінки
);
selector('.catalog-grid__cell').each((index, element) => { // Виправлено параметри функції each
const title = selector(element).find('.goods-tile__title').text();
console.log(title, link); // Додано вивід посилання
});
}
};
parse();
</script>
Есть какой-то способ который находит цену на сайте в карточке товара, автоматический даже можно с помощью ИИ?
Дело в том, что бывает карточки товаров отличаются немного друг от друга и нужно указывать несколько селекторов, это замедляет процесс.
На его смену хочу взять побольше размером 27-28, с разрешением 2k.
смысла брать 4k и 30 дюймовые наверное нет...
import os
import glob
# sort by change date
def sort(path, ext="*.jpg"):
files = glob.glob(os.path.join(path, ext))
files.sort(key=os.path.getmtime)
return files
# rename files
def rename(path):
_sorted = sort(path)
for i, file_path in enumerate(_sorted, 1):
folder, old_name = os.path.split(file_path)
new_name = f"{i}.jpg"
new_path = os.path.join(folder, new_name)
os.rename(file_path, new_path)
print(f"Rename {old_name} to {new_name}")
if __name__ == "__main__":
# path to dir with images
folder_path = "/path/to/dir/images"
rename(folder_path)
Просто блок div c классом
Класс js-pagination-item
div.js-pagination-item
.// wait dom loaded
document.addEventListener('DOMContentLoaded', () => {
// observer
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes.length > 0) {
mutation.addedNodes.forEach((node) => {
// target element
if (node.nodeType === 1 && node.classList.contains('js-pagination-item')) {
// print in the console log
console.log('Detected element!');
}
});
}
});
});
// start
observer.observe(document.body, {childList: true, subtree: true});
});
# 123.ru > redirect 301 > http://12345.ru,
# 123.ru/?test=123 > redirect 301 > http://12345.ru,
# 123.ru/cats/?test=123 > redirect 301 > http://12345.ru:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^123\.ru [NC]
RewriteRule ^(.*)$ http://12345.ru/ [L,R=301]
# 123.ru > redirect 301 > http://12345.ru,
# 123.ru/?test=123 > redirect 301 > http://12345.ru/?test=123,
# 123.ru/cats/?test=123 > redirect 301 > http://12345.ru/cats/?test=123:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^123\.ru [NC]
RewriteRule ^(.*)$ http://12345.ru/$1 [L,R=301]
# 123.ru/cats/?test=123 > redirect 301 > http://12345.ru:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^123\.ru [NC]
RewriteRule ^(.*)$ http://12345.ru/ [L,R=301]