Дз парсинг

This commit is contained in:
inweems
2023-03-30 23:18:37 +03:00
parent 56d6a99a71
commit 8ffe189bbe
2 changed files with 30 additions and 9 deletions
+15 -9
View File
@@ -4,9 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e5615680-c090-497d-a104-1337ed85f850" name="Changes" comment="Первый коммит"> <list default="true" id="e5615680-c090-497d-a104-1337ed85f850" name="Changes" comment="Дз парсинг" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -35,11 +33,11 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;last_opened_file_path&quot;: &quot;C:/Users/71332/PycharmProjects/c22712&quot; "last_opened_file_path": "C:/Users/Honor/c22712"
} }
}</component> }]]></component>
<component name="RunManager" selected="Python.zaparsil"> <component name="RunManager" selected="Python.zaparsil">
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="22712" /> <module name="22712" />
@@ -142,7 +140,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1679839777822</updated> <updated>1679839777822</updated>
</task> </task>
<option name="localTasksCounter" value="7" /> <task id="LOCAL-00007" summary="Дз парсинг">
<created>1680206771744</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1680206771744</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@@ -162,7 +167,8 @@
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Первый коммит" /> <MESSAGE value="Первый коммит" />
<MESSAGE value="parser" /> <MESSAGE value="parser" />
<option name="LAST_COMMIT_MESSAGE" value="parser" /> <MESSAGE value="Дз парсинг" />
<option name="LAST_COMMIT_MESSAGE" value="Дз парсинг" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
+15
View File
@@ -0,0 +1,15 @@
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service('D:\data\chromedriver.exe')
browser = webdriver.Chrome(service=s)
browser.get('https://www.kfc.ru/')
html_text = browser.page_source
soup = BeautifulSoup(html_text, 'lxml')
prices = soup.find_all(attrs={"class": "GFmMCzZoYv"})
titles = soup.find_all(attrs={"class": "_14ZQf5wtqx c-description"})
for price, title in zip(prices, titles):
print(f" название {title.text} ; цена: {price.text}")