Проблема отображения html кода элемента при парсинге html странице
Начал изучать парсинг. Как тестовый проект хочу парсить данные с сайта.
По ссылке на профиль магазина хочу программно получить данные о количестве заказов и отзывов. Думал это легко, но как оказалось нет.
При выполнении кода (Пока что получаю весь html):
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
URL_TEMPLATE = "https://kazanexpress.ru/appleplace"
r = requests.get(URL_TEMPLATE)
print(r.status_code)
print(r.text)
получаю совсем не тот html, что видел в коде элемента, а что-то вроде этого:
<!DOCTYPE html><html lang=ru><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta http-equiv=content-language content=ru><meta http-equiv=Cache-control content="no-cache, no-store, must-revalidate"><meta http-equiv=Pragma content=no-cache><meta name=description content="Маркетплейс доступных цен с бесплатной доставкой за 1 день"><meta name=keywords content="маркетплейс, интернет-магазин, доставка на следующий день, низкие цены, купить дешево, быстрая доставка, лучшие цены"><meta id=prerender-status-code name=prerender-status-code content=200><meta id=prerender-header name=prerender-header content=""><title>Выгодные покупки быстрее чем за сутки</title><link rel=icon type=image/png sizes=32x32 href=/static/img/icons/favicon-32.png><link rel=icon type=image/png sizes=16x16 href=/static/img/icons/favicon-16.png><meta name=ROBOTS content="INDEX, FOLLOW"><meta property=og:url content=""><meta property=og:title content=""><meta property=og:description content=""><meta property=og:image itemprop=image content=""><meta property=og:image:secure_url content=""><meta property=og:type content=website><meta property=product:brand content=""><meta property=product:availability content=""><meta property=product:condition content=new><meta property=product:price:amount content=""><meta property=product:retailer_item_id content=""><meta property=product:price:currency content=RUB><link rel=canonical href=https://kazanexpress.ru/ ><link itemprop=thumbnailUrl href=url_image><meta name=twitter:image content=""><meta name=apple-itunes-app content="app-id=1438104323"><meta name=facebook-domain-verification content=rb1tipol8glrbndktmbkyom0xaqomi><meta name=google-site-verification content=ffMsQuJJt9A3n3pN6FcpIKq8UcuWj1gvjMdvqLxEwMI><meta name=google-site-verification content=QrVT-SLKbPGSA5shhmMLeS9ilfJ-V7IoNDb3pxgHvt4><meta name=google-site-verification content=_Jd4DyFIJ-LlvrfYl7nq9VsJGU0Dl-fSewUtb8xFY1M><meta name=google-site-verification content=22lwQj3aZEg4S0p9e0z4t561wEmGC5q1u3yxbu7qAC8><meta name=google-site-verification content=R674rCopA_NzCaJ7A72UfmTkpXBUyudgh0a4u_JznQE><meta name=google-site-verification content=86eWgZxBzwHcvvnNMA8WPOAxjOOesyMvyQBzz3BW3BQ><meta name=mailru-verification content=2be7cbd6459741ed><meta name=yandex-verification content=1737294911c38a7a><meta name=yandex-verification content=c1a636f058f5aae4><meta name=yandex-verification content=12e93a30f6213678><meta name=mailru-verification content=67628f3035f4dc15><!--[if IE]><link rel="shortcut icon" href="/static/img/icons/favicon.ico"><![endif]--><meta name=theme-color content=#E53935><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=white><meta name=apple-mobile-web-app-title content=KazanExpress><link rel=apple-touch-icon href=/static/img/icons/apple-touch-icon.png><link rel=mask-icon href=/static/img/icons/safari-pinned-tab.svg color=#e53935><meta name=msapplication-TileImage content=/static/img/icons/mstile-144x144.png><meta name=msapplication-TileColor content=#FFF><script nomodule type=text/javascript src=https://cdn.polyfill.io/v2/polyfill.min.js defer=defer></script><link rel=stylesheet href=/static/css/styleoff.css><link rel=stylesheet href=/static/css/fonts.css><link rel=stylesheet href=/static/css/typebase.css><link rel=stylesheet href=/static/css/helpers.css><script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default-3.6,fetch" defer=defer></script><script>(
function(w,d,s,l,i) {
w[l]=w[l]||[];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),
dl=l!='dataLayer'?'&l='+l:'';
window.dataLayer = window.dataLayer || [];
j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;
f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KTRMJ4R');</script><script type=text/javascript src=https://vk.com/js/api/openapi.js?158 onload="function onload() { VK.Retargeting.Init('VK-RTRG-1007905-4evhc'), VK.Retargeting.Hit() }"></script><script type=text/javascript>if (!window.VK) {
window.VK = {}; VK._protocol = 'https:'; VK._base_domain = ''; if (!VK.Retargeting) { VK.Retargeting = { pixelCode: null, Init: function (pixelCode) { this.pixelCode = pixelCode; return this }, Event: function (event) { if (!this.pixelCode) { return } (window.Image ? (new Image()) : document.createElement('img')).src = 'https://vk.com/rtrg?p=' + this.pixelCode + (event ? ('&event=' + encodeURIComponent(event)) : '') }, Hit: function () { this.Event() }, Add: function (audienceID) { if (!this.pixelCode || !audienceID) { return } (window.Image ? (new Image()) : document.createElement('img')).src = 'https://vk.com/rtrg?p=' + this.pixelCode + '&audience=' + encodeURIComponent(audienceID) } } };
}
VK.Retargeting.Init('VK-RTRG-1007905-4evhc');
VK.Retargeting.Hit();</script><noscript><img src="https://vk.com/rtrg?p=VK-RTRG-1007905-4evhc" style="position:fixed; left:-999px;" alt=""></noscript><script type=text/javascript>!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://vk.com/js/api/openapi.js?168",t.onload=function(){VK.Retargeting.Init("VK-RTRG-547218-gUAWw"),VK.Retargeting.Hit()},document.head.appendChild(t)}();</script><noscript><img src="https://vk.com/rtrg?p=VK-RTRG-547218-gUAWw" style="position:fixed; left:-999px;" alt=""></noscript><script defer=defer src=/static/js/app.36ef5c46fb7997382b65.js?103ead44d0f3c532ea45></script></head><body><app></app><noscript><div style="width: 100%;text-align: center;transform: translateY(50vh);transform: translateY(calc(50vh - 50%));"><svg id=Layer_1 data-name="Layer 1" xmlns=http://www.w3.org/2000/svg viewBox="0 0 76.73 76.88" style="width: 36px;height: 36px;"><defs><style>.cls-1 {
fill: #e53935;
}</style></defs><title>KazanExpress</title><path class=cls-1 d=M56.06,53.61H47.74L35.36,37.88h0L47.51,23.27h8.31L45.94,35.15H76.73a38.44,38.44,0,1,0,0,6.58h-30Zm-23.12,0H26.36V23.27h6.58V53.61Z></path></svg><p>Пожалуйста, включите JavaScript, чтобы воспользоваться сайтом!</p></div></noscript><script type=text/javascript>var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "3210365", type: "pageView", start: (new Date()).getTime()});
(function (d, w, id) {
if (d.getElementById(id)) return;
var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id;
ts.src = "https://top-fwz1.mail.ru/js/code.js";
var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
})(document, window, "topmailru-code");</script><noscript><div><img src="https://top-fwz1.mail.ru/counter?id=3210365;js=na" style=border:0;position:absolute;left:-9999px; alt=Top.Mail.Ru></div></noscript><script type=text/javascript>var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://9943304.fls.doubleclick.net/activityi;src=9943304;type=visitors;cat=kazan0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');</script><noscript><iframe src="https://9943304.fls.doubleclick.net/activityi;src=9943304;type=visitors;cat=kazan0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=; ord=1?" width=1 height=1 frameborder=0 style=display:none></iframe></noscript><script>mindbox = window.mindbox || function() { mindbox.queue.push(arguments); };
mindbox.queue = mindbox.queue || [];</script><script>mindbox('create', { endpointId: 'kazanexpress-website' });</script><script src=https://api.mindbox.ru/scripts/v1/tracker.js async></script><noscript><div><img src="//top-fwz1.mail.ru/counter?id=3052180;js=na" style=border:0;position:absolute;left:-9999px; alt=""></div></noscript><script type=text/javascript>!function () { var t = document.createElement("script"); t.type = "text/javascript", t.async = !0, t.src = "https://vk.com/js/api/openapi.js?158", t.onload = function () { VK.Retargeting.Init("VK-RTRG-1007905-4evhc"), VK.Retargeting.Hit() }, document.head.appendChild(t) }();</script><noscript><img src="https://vk.com/rtrg?p=VK-RTRG-1007905-4evhc" style="position:fixed; left:-999px;" alt=""></noscript><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KTRMJ4R" height=0 width=0 style=display:none;visibility:hidden></iframe></noscript><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:400,500,700&subset=cyrillic" preload></body></html>