Sanchez.
07.03.2022, 01:18
Крч, решил сделать я парсер, но почему то в консоль не выводит товары. В чём проблема?
Python:
from
bs4
import
BeautifulSoup
import
requests
url
=
'https://www.avito.ru/'
response
=
requests
.
get
(
url
)
soup
=
BeautifulSoup
(
response
.
content
,
'html.parser'
)
items
=
soup
.
findAll
(
'div'
,
class_
=
'styles-item-W5Z4K'
)
cars
=
[
]
for
item
in
items
:
cars
.
append
(
{
'title'
:
item
.
find
(
'a'
,
class_
=
'link-link-MbQDP link-design-default-_nSbv title-root-zZCwT body-title-drnL0 title-root_maxHeight-X6PsH'
)
.
get_text
(
strip
=
True
)
}
)
for
car
in
cars
:
print
(
car
[
'title'
]
)
Прошу меня не обсирать, так как первый раз работаю с пайтоном
Python:
from
bs4
import
BeautifulSoup
import
requests
url
=
'https://www.avito.ru/'
response
=
requests
.
get
(
url
)
soup
=
BeautifulSoup
(
response
.
content
,
'html.parser'
)
items
=
soup
.
findAll
(
'div'
,
class_
=
'styles-item-W5Z4K'
)
cars
=
[
]
for
item
in
items
:
cars
.
append
(
{
'title'
:
item
.
find
(
'a'
,
class_
=
'link-link-MbQDP link-design-default-_nSbv title-root-zZCwT body-title-drnL0 title-root_maxHeight-X6PsH'
)
.
get_text
(
strip
=
True
)
}
)
for
car
in
cars
:
(
car
[
'title'
]
)
Прошу меня не обсирать, так как первый раз работаю с пайтоном