If I understand you correctly, you need to generate an array for later use?
It goes something like this:
It goes something like this:
import requests
from bs4 import BeautifulSoup
def get_urls(url: str) -> list:
url = requests.get(url)
soup = BeautifulSoup(url.content, 'lxml')
keys = ["ru/item/"]
urls = [
f"https://all-avito.ru/{url}"
for url in map(lambda x: x.get('href'), soup.find_all('a'))
for key in keys if key in str(url)
]
return urls
print(get_urls("https://all-avito.ru/ru/phone/89039123444"))