import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium_stealth import stealth
proxy = '45.132.75.19:23820'
options = Options()
options.add_argument('--proxy-server=socks5://' + proxy)
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("window-size=1920,1080")
# options.add_argument("--incognito")
options.add_argument("--disable-extensions")
options.add_argument("--disable-plugins-discovery")
options.add_argument("--start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
executable_path = './chromedriver-121.0.6167.85.exe'
service = Service(executable_path=executable_path)
driver = webdriver.Chrome(service=service, options=options)
stealth(driver,
languages=["en-US", "en"],
vendor="Google Inc.",
platform="Win64",
webgl_vendor="Intel Inc.",
renderer="Intel Iris OpenGL Engine",
fix_hairline=True,
run_on_insecure_origins=True,
user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.85 Safari/537.36',
)
try:
driver.get('https://allegro.pl/kategoria/laptopy-491')
time.sleep(30)
print(driver.page_source)
finally:
driver.quit()
Пытался забрать html простым реквестом, получалась не очень
попробовал через selenium - получил то же самое
import requests
import socks
import socket
socks.set_default_proxy(socks.SOCKS5, "45.56.219.55", 52759)
socket.socket = socks.socksocket
url = 'https://www.skiddle.com/festivals/dates.html'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
try:
response = requests.get(url, headers=headers, timeout=10)
response.raise_for_status()
print(response.text)
except requests.exceptions.HTTPError as errh:
print("Http Error:", errh)
except requests.exceptions.ConnectionError as errc:
print("Connecting Error:", errc)
except requests.exceptions.Timeout as errt:
print("Timeout Error:", errt)
except requests.exceptions.RequestException as err:
print("Other Error", err)
<!DOCTYPE html>
<!--[if lt IE 7]><html class='ie ie6 lte9 lte8 lte7 no-js'> <![endif]-->
<!--[if IE 7]><html class='ie ie7 lte9 lte8 lte7 no-js'> <![endif]-->
<!--[if IE 8]><html class='ie ie8 lte9 lte8 no-js'> <![endif]-->
<!--[if IE 9]><html class='ie ie9 lte9 no-js'> <![endif]-->
<!--[if gt IE 9]><html class='ie no-js'><![endif]-->
<!--[if !IE]><!--> <html class='no-ie no-js' lang='en'><!--<![endif]-->
<head><!-- Basic Page Needs
================================================== -->
<title>A-Z of Future Festivals</title>
<link rel="manifest" href="/manifest.json">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><!-- DNS Prefetching
================================================== -->
<link rel="preconnect" href="https://d31fr2pwly4c4s.cloudfront.net"/>
<link rel="preconnect" href="https://d1plawd8huk6hh.cloudfront.net"/>
<link rel="preconnect" href="https://www.google-analytics.com" />
<link rel="preload" href="https://d1plawd8huk6hh.cloudfront.net/css-responsive2/fonts/BuenosAires/BuenosAiresWeb1-Regular_gdi.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="https://d1plawd8huk6hh.cloudfront.net/css-responsive2/fonts/BuenosAires/BuenosAiresWeb1-Bold_gdi.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="dns-prefetch" href="https://d31fr2pwly4c4s.cloudfront.net"/>
<link rel="dns-prefetch" href="https://d1plawd8huk6hh.cloudfront.net"/>
<link rel="dns-prefetch" href="https://www.google-analytics.com" />
<link rel="dns-prefetch" href="//connect.facebook.net" />
<link rel="dns-prefetch" href="//www.googleadservices.com" />
<link rel="dns-prefetch" href="//www.stay22.com" />
<link rel="dns-prefetch" href="//api.stay22.com" />
<link rel="dns-prefetch" href="//skiddle.imgix.net" />
<link rel="dns-prefetch" href="//skiddleartists.imgix.net" />
<!-- CSS
================================================== -->
<meta property="fb:app_id" content="102483650494"/>
<meta http-equiv="x-dns-prefetch-control" content="on"/>
<meta name="insight-app-sec-validation" content="5574b896-289f-48c0-aebb-98730b831151">
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
...
Процессор - Intel(R) Celeron(R) N4020 CPU @ 1.10GHz 1.10 GHz
Оперативная память - 4,00 ГБ
Если установить версию по старее, будет ли нормально работать в нем?
как в RewriteCond сделать правило на просмотр файла и если в нем есть совпадения с %{HTTP_COOKIE}
RewriteMap blocked txt:/banned.txt
RewriteCond %{HTTP_COOKIE} PHPSESSID=(.+)
RewriteCond ${blocked:%1} =1
RewriteRule ^ - [F]
Официальное трудоустройство гражданина РБ на удаленку в российскую компанию?
Но вот на днях прочитал, что meta keywords считается застарелым и поисковики его не используют сейчас.
Чтобы иметь хоть какое-то представление на практике о работе в них?
Но т.к. Твиттер заблокирован я подумал, что может быть это все не законно, но так ли это?
С одной стороны мне кажется её рискованно делать, с другой видел много новостей, которые пришли с заблокированных сайтов и всё вроде нормально.
got an unexpected keyword argument 'verify_ssl'
def f(string, index, length):
return not (length < 0 or index < 0 or index >= len(string) or length + index > len(string))
string = 'Winter is coming'
print(f(string, 4, 4))
# True
print(f(string, 4, -1))
# False
print(f(string, -1, 4))
# False
print(f(string, len(string), 4))
# False
print(f(string, len(string) - 3, 5))
# False
Что делает единичная звездочка в аргументах метода Python?
namedtuple(
typename,
field_names,
*,
rename=False,
defaults=None,
module=None,
)
Ни разу не встречал такое раньше, в документации тоже не смог откопать
Подскажите, как изменить содержимое input в html?
<div class="ant-input-number-input-wrap">
<input autocomplete="off" role="spinbutton" step="1" class="ant-input-number-input" value="100 000" aria-valuenow="100000">
</div>
const input = document.querySelector('.ant-input-number-input');
input.value = 'new value';
Если редактировать непосредственно в атрибутах (value и aria-valuenow), то в самом input на странице изменения не отображаются (остается значение "100 000"), на сервер возможно уйдет значение из этих атрибутов, но как обновить отображение?
const cb = (mutationsList, observer) => {
for (const mutation of mutationsList) {
if (mutation.type === 'attributes' && mutation.attributeName === 'aria-valuenow') {
mutation.target.value = mutation.target.getAttribute('aria-valuenow');
}
}
}
const input = document.querySelector('.ant-input-number-input');
const observer = new MutationObserver(cb);
observer.observe(input, {attributes: true});
Какие есть способы для решения задачи (желательно из ЯП использовать python)
Тинькофф сбрасывает любые сессии каждые 12 часов
Проблемы возникают на моменте ввода кода из смс, как его можно перенаправить серверу?
Автоматическая генерация контента на станице на основании GET параметров, хороший вариант для SEO?
Подгружается не только содержимое, но еще меняет title и description.
С точки SEO это вообще будет как-то продвигаться или для каждого вопроса делать отдельную страницу?