Artem-Darius Weber 4 months ago
commit bf26c308d9

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

@ -0,0 +1,187 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="159">
<item index="0" class="java.lang.String" itemvalue="httpx" />
<item index="1" class="java.lang.String" itemvalue="Babel" />
<item index="2" class="java.lang.String" itemvalue="sorted-nearest" />
<item index="3" class="java.lang.String" itemvalue="PyYAML" />
<item index="4" class="java.lang.String" itemvalue="marshmallow" />
<item index="5" class="java.lang.String" itemvalue="executing" />
<item index="6" class="java.lang.String" itemvalue="fisher" />
<item index="7" class="java.lang.String" itemvalue="gradio_client" />
<item index="8" class="java.lang.String" itemvalue="Pygments" />
<item index="9" class="java.lang.String" itemvalue="langchain" />
<item index="10" class="java.lang.String" itemvalue="starlette" />
<item index="11" class="java.lang.String" itemvalue="bleach" />
<item index="12" class="java.lang.String" itemvalue="jupyter_server_terminals" />
<item index="13" class="java.lang.String" itemvalue="soupsieve" />
<item index="14" class="java.lang.String" itemvalue="uvicorn" />
<item index="15" class="java.lang.String" itemvalue="jsonschema" />
<item index="16" class="java.lang.String" itemvalue="terminado" />
<item index="17" class="java.lang.String" itemvalue="comm" />
<item index="18" class="java.lang.String" itemvalue="pydub" />
<item index="19" class="java.lang.String" itemvalue="gunicorn" />
<item index="20" class="java.lang.String" itemvalue="click" />
<item index="21" class="java.lang.String" itemvalue="ipykernel" />
<item index="22" class="java.lang.String" itemvalue="nbconvert" />
<item index="23" class="java.lang.String" itemvalue="attrs" />
<item index="24" class="java.lang.String" itemvalue="contourpy" />
<item index="25" class="java.lang.String" itemvalue="psutil" />
<item index="26" class="java.lang.String" itemvalue="dataclasses-json" />
<item index="27" class="java.lang.String" itemvalue="jedi" />
<item index="28" class="java.lang.String" itemvalue="openai" />
<item index="29" class="java.lang.String" itemvalue="jupyter_server" />
<item index="30" class="java.lang.String" itemvalue="natsort" />
<item index="31" class="java.lang.String" itemvalue="asttokens" />
<item index="32" class="java.lang.String" itemvalue="platformdirs" />
<item index="33" class="java.lang.String" itemvalue="matplotlib" />
<item index="34" class="java.lang.String" itemvalue="pandavro" />
<item index="35" class="java.lang.String" itemvalue="jsonpatch" />
<item index="36" class="java.lang.String" itemvalue="httpcore" />
<item index="37" class="java.lang.String" itemvalue="referencing" />
<item index="38" class="java.lang.String" itemvalue="json5" />
<item index="39" class="java.lang.String" itemvalue="pyfaidx" />
<item index="40" class="java.lang.String" itemvalue="numpy" />
<item index="41" class="java.lang.String" itemvalue="requests" />
<item index="42" class="java.lang.String" itemvalue="fastavro" />
<item index="43" class="java.lang.String" itemvalue="grpcio-reflection" />
<item index="44" class="java.lang.String" itemvalue="jupyter-events" />
<item index="45" class="java.lang.String" itemvalue="websocket-client" />
<item index="46" class="java.lang.String" itemvalue="sqlalchemy2-stubs" />
<item index="47" class="java.lang.String" itemvalue="pysam" />
<item index="48" class="java.lang.String" itemvalue="stack-data" />
<item index="49" class="java.lang.String" itemvalue="methplotlib" />
<item index="50" class="java.lang.String" itemvalue="zipp" />
<item index="51" class="java.lang.String" itemvalue="nest-asyncio" />
<item index="52" class="java.lang.String" itemvalue="tenacity" />
<item index="53" class="java.lang.String" itemvalue="mmh3" />
<item index="54" class="java.lang.String" itemvalue="prompt-toolkit" />
<item index="55" class="java.lang.String" itemvalue="linkify-it-py" />
<item index="56" class="java.lang.String" itemvalue="websockets" />
<item index="57" class="java.lang.String" itemvalue="ipywidgets" />
<item index="58" class="java.lang.String" itemvalue="pyarrow" />
<item index="59" class="java.lang.String" itemvalue="watchfiles" />
<item index="60" class="java.lang.String" itemvalue="tornado" />
<item index="61" class="java.lang.String" itemvalue="aiofiles" />
<item index="62" class="java.lang.String" itemvalue="jsonpointer" />
<item index="63" class="java.lang.String" itemvalue="Send2Trash" />
<item index="64" class="java.lang.String" itemvalue="plotly" />
<item index="65" class="java.lang.String" itemvalue="overrides" />
<item index="66" class="java.lang.String" itemvalue="python-multipart" />
<item index="67" class="java.lang.String" itemvalue="toml" />
<item index="68" class="java.lang.String" itemvalue="mistune" />
<item index="69" class="java.lang.String" itemvalue="pandas" />
<item index="70" class="java.lang.String" itemvalue="importlib-resources" />
<item index="71" class="java.lang.String" itemvalue="toolz" />
<item index="72" class="java.lang.String" itemvalue="mpmath" />
<item index="73" class="java.lang.String" itemvalue="pyranges" />
<item index="74" class="java.lang.String" itemvalue="debugpy" />
<item index="75" class="java.lang.String" itemvalue="argon2-cffi" />
<item index="76" class="java.lang.String" itemvalue="yarl" />
<item index="77" class="java.lang.String" itemvalue="pytz" />
<item index="78" class="java.lang.String" itemvalue="moreorless" />
<item index="79" class="java.lang.String" itemvalue="Pillow" />
<item index="80" class="java.lang.String" itemvalue="notebook_shim" />
<item index="81" class="java.lang.String" itemvalue="traitlets" />
<item index="82" class="java.lang.String" itemvalue="bowler" />
<item index="83" class="java.lang.String" itemvalue="protobuf" />
<item index="84" class="java.lang.String" itemvalue="rfc3339-validator" />
<item index="85" class="java.lang.String" itemvalue="arrow" />
<item index="86" class="java.lang.String" itemvalue="mypy" />
<item index="87" class="java.lang.String" itemvalue="python-dotenv" />
<item index="88" class="java.lang.String" itemvalue="nbclient" />
<item index="89" class="java.lang.String" itemvalue="partd" />
<item index="90" class="java.lang.String" itemvalue="MarkupSafe" />
<item index="91" class="java.lang.String" itemvalue="locket" />
<item index="92" class="java.lang.String" itemvalue="tinycss2" />
<item index="93" class="java.lang.String" itemvalue="httptools" />
<item index="94" class="java.lang.String" itemvalue="frozenlist" />
<item index="95" class="java.lang.String" itemvalue="appdirs" />
<item index="96" class="java.lang.String" itemvalue="python-json-logger" />
<item index="97" class="java.lang.String" itemvalue="semantic-version" />
<item index="98" class="java.lang.String" itemvalue="filelock" />
<item index="99" class="java.lang.String" itemvalue="jupyterlab-widgets" />
<item index="100" class="java.lang.String" itemvalue="pyzmq" />
<item index="101" class="java.lang.String" itemvalue="certifi" />
<item index="102" class="java.lang.String" itemvalue="anyio" />
<item index="103" class="java.lang.String" itemvalue="Markdown" />
<item index="104" class="java.lang.String" itemvalue="sympy" />
<item index="105" class="java.lang.String" itemvalue="uvloop" />
<item index="106" class="java.lang.String" itemvalue="notebook" />
<item index="107" class="java.lang.String" itemvalue="beautifulsoup4" />
<item index="108" class="java.lang.String" itemvalue="isoduration" />
<item index="109" class="java.lang.String" itemvalue="jupyter-lsp" />
<item index="110" class="java.lang.String" itemvalue="fqdn" />
<item index="111" class="java.lang.String" itemvalue="jupyter_client" />
<item index="112" class="java.lang.String" itemvalue="orjson" />
<item index="113" class="java.lang.String" itemvalue="jupyterlab_server" />
<item index="114" class="java.lang.String" itemvalue="altair" />
<item index="115" class="java.lang.String" itemvalue="feast" />
<item index="116" class="java.lang.String" itemvalue="fonttools" />
<item index="117" class="java.lang.String" itemvalue="mdit-py-plugins" />
<item index="118" class="java.lang.String" itemvalue="widgetsnbextension" />
<item index="119" class="java.lang.String" itemvalue="charset-normalizer" />
<item index="120" class="java.lang.String" itemvalue="uc-micro-py" />
<item index="121" class="java.lang.String" itemvalue="biopython" />
<item index="122" class="java.lang.String" itemvalue="dask" />
<item index="123" class="java.lang.String" itemvalue="ffmpy" />
<item index="124" class="java.lang.String" itemvalue="langsmith" />
<item index="125" class="java.lang.String" itemvalue="numexpr" />
<item index="126" class="java.lang.String" itemvalue="gradio" />
<item index="127" class="java.lang.String" itemvalue="webcolors" />
<item index="128" class="java.lang.String" itemvalue="async-timeout" />
<item index="129" class="java.lang.String" itemvalue="SQLAlchemy" />
<item index="130" class="java.lang.String" itemvalue="sklearn" />
<item index="131" class="java.lang.String" itemvalue="cloudpickle" />
<item index="132" class="java.lang.String" itemvalue="wcwidth" />
<item index="133" class="java.lang.String" itemvalue="jupyter_core" />
<item index="134" class="java.lang.String" itemvalue="importlib-metadata" />
<item index="135" class="java.lang.String" itemvalue="rfc3986-validator" />
<item index="136" class="java.lang.String" itemvalue="typeguard" />
<item index="137" class="java.lang.String" itemvalue="ncls" />
<item index="138" class="java.lang.String" itemvalue="jsonschema-specifications" />
<item index="139" class="java.lang.String" itemvalue="rpds-py" />
<item index="140" class="java.lang.String" itemvalue="uri-template" />
<item index="141" class="java.lang.String" itemvalue="fissix" />
<item index="142" class="java.lang.String" itemvalue="urllib3" />
<item index="143" class="java.lang.String" itemvalue="jupyterlab" />
<item index="144" class="java.lang.String" itemvalue="Cython" />
<item index="145" class="java.lang.String" itemvalue="six" />
<item index="146" class="java.lang.String" itemvalue="pyTelegramBotAPI" />
<item index="147" class="java.lang.String" itemvalue="nbformat" />
<item index="148" class="java.lang.String" itemvalue="ipython" />
<item index="149" class="java.lang.String" itemvalue="dill" />
<item index="150" class="java.lang.String" itemvalue="volatile" />
<item index="151" class="java.lang.String" itemvalue="fastjsonschema" />
<item index="152" class="java.lang.String" itemvalue="prometheus-client" />
<item index="153" class="java.lang.String" itemvalue="tqdm" />
<item index="154" class="java.lang.String" itemvalue="fastapi" />
<item index="155" class="java.lang.String" itemvalue="proto-plus" />
<item index="156" class="java.lang.String" itemvalue="aiohttp" />
<item index="157" class="java.lang.String" itemvalue="grpcio" />
<item index="158" class="java.lang.String" itemvalue="async-lru" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N803" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="random.random.choice" />
</list>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (klfasdkfdsklf)" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/klfasdkfdsklf.iml" filepath="$PROJECT_DIR$/.idea/klfasdkfdsklf.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,61 @@
import requests
from bs4 import BeautifulSoup
import csv
from tqdm import tqdm
# Базовый URL для страниц палитр
base_url = "https://www.color-hex.com/color-palettes/?page="
# Количество страниц, которые нужно парсить
total_pages = 1780
output_file = "color_palettes.csv"
with open(output_file, mode='w', newline='', encoding='utf-8') as file:
writer = csv.writer(file)
# Заголовки CSV
headers = ['Palette Category', 'Palette Name'] + [f"Color {i + 1}" for i in range(448)]
writer.writerow(headers)
for page in tqdm(range(1, total_pages + 1), desc="Parsing pages", unit="page"):
# Формируем URL для текущей страницы
url = f"{base_url}{page}"
response = requests.get(url)
if response.status_code == 200:
soup = BeautifulSoup(response.content, 'html.parser')
# Ищем все контейнеры палитр
palettes = soup.find_all('div', class_='palettecontainerlist')
# Проходим по каждой палитре и собираем информацию
for palette in palettes:
# Ищем ссылку с названием палитры (тег <a>)
title_tag = palette.find('a')
palette_name = title_tag['title'] if title_tag else 'No title'
palette_category = "Default Category"
# Ищем все div с цветами внутри палитры
color_divs = palette.find_all('div', class_='palettecolordiv')
color_codes = []
# Извлекаем цвета из атрибута style
for div in color_divs:
style = div['style']
# Ищем hex-код цвета в стиле
color_code = style.split('background-color:')[1].replace(';', '').strip()
color_codes.append(color_code)
# Заполняем недостающие ячейки пустыми значениями, если цветов меньше 448
while len(color_codes) < 448:
color_codes.append('')
writer.writerow([palette_category, palette_name] + color_codes)
else:
print(f"Ошибка при запросе страницы {page}: {response.status_code}")
print(f"Парсинг завершён. Данные записаны в файл {output_file}")

@ -0,0 +1,3 @@
requests==2.31.0
beautifulsoup4==4.12.2
tqdm==4.66.1
Loading…
Cancel
Save