Я пытаюсь получить описание поста для каждого изображения в Instagram, но я получаю лишь небольшую часть описания. Может кто-нибудь, пожалуйста, помогите мне получить полное описание сообщения pi c?
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
# ---------------- getting hrefs in posts ------------------ #
# Step 1
driver = webdriver.Chrome('/Users/jjcauton/Documents/python/chromedriver')
driver.get('https://www.instagram.com/addict_for_sneakers/')
hrefs = driver.find_elements_by_tag_name('a')
print(hrefs)
hrefs_elem = [elem.get_attribute('href') for elem in hrefs]
hrefs_elem = [href for href in hrefs_elem if '/p/' in href]
print(hrefs_elem)
for href in hrefs_elem:
driver.get(href)
page = requests.get(href)
soup = BeautifulSoup(page.content, 'lxml')
page_contents = soup.title
contents = page_contents.get_text()
print(contents)
Результаты получились так:
Boricua Adicto A Tenis on Instagram: “? Giveaway ? Win a FREE pair of Adidas Yeezy 350 v2 "Yeshaya" (Winner Picks His or Her Size) by following the simple steps below. Here’s…”
Boricua Adicto A Tenis on Instagram: “1,2,3,4,5,6,7,8,9 or 10?
#Tecatodetenis”
Boricua Adicto A Tenis on Instagram: “The the future of sneakers trading is here ? Make money by buying shares, then selling them for more than what you paid ? Start with only…”
Boricua Adicto A Tenis on Instagram: “What’s your favorite AJ11?”
Boricua Adicto A Tenis on Instagram: “? Giveaway ? Win a FREE pair of Retro 1 Fearless by following the simple steps below. Here’s how you can win?: 1️⃣ Follow:…”
Boricua Adicto A Tenis on Instagram: “1,2,3,4,5,6,7,8,9 or 10?
#Tecatodetenis”
Boricua Adicto A Tenis on Instagram: “Choose One!”
Boricua Adicto A Tenis on Instagram: “?FREE?GIVEAWAY? Win the ?️red 1️⃣1️⃣ for FREE by following these steps: Step 1️⃣. Follow them?: @_jsole_ @wallkicksofficial @pr_sneaks23…”
Boricua Adicto A Tenis on Instagram: “What’s your favorite retro 4?”
Boricua Adicto A Tenis on Instagram: “? Giveaway ? Win a FREE pair of Retro 1 Turbo Green by following the simple steps below. Here’s how you can win?: 1️⃣ Follow:…”
Boricua Adicto A Tenis on Instagram: “1,2,3,4,5,6,7,8,9 or 10?
#Tecatodetenis”
Boricua Adicto A Tenis on Instagram: “✨LAST CHANCE✨ ☁️CHOOSE YOUR FAVORITE SHOE☁️ ⠀ To Enter Simply: 1️⃣: Like This Picture 2️⃣: Follow @Luisanglcordova @Hypedseason…”
Как вы можете видеть, это дает только небольшое часть описания сообщения pi c. Мне нужно полное описание. Спасибо!