from bs4 import BeautifulSoup
import requests
url = 'https://www.tutorialspoint.com/beautiful_soup/index.htm'
req = requests.get(url)
# Parse the page using Beautiful constructor using a string method
soup = BeautifulSoup(req.text, 'html.parser')
print(soup.title)
<title>Beautiful Soup Tutorial - Tutorialspoint</title>
print(soup.href)
None
for link in soup.find_all('a'):
print(link.get('href'))
https://www.tutorialspoint.com/index.htm https://www.tutorialspoint.com/about/about_careers.htm https://www.tutorialspoint.com/online_dev_tools.htm https://www.tutorialspoint.com/codingground.htm https://www.tutorialspoint.com/current_affairs.htm https://www.tutorialspoint.com/upsc_ias_exams.htm https://www.tutorialspoint.com/tutor_connect/index.php https://www.tutorialspoint.com/whiteboard.htm https://www.tutorialspoint.com/netmeeting.php https://www.tutorix.com /videotutorials/login.php /videotutorials/subscription.php https://www.facebook.com/tutorialspointindia https://www.twitter.com/tutorialspoint https://www.linkedin.com/company/tutorialspoint https://www.youtube.com/channel/UCVLbzhxVTiTLiVKeGV7WEBg https://www.tutorialspoint.com/index.htm None /academic_tutorials.htm /big_data_tutorials.htm /computer_programming_tutorials.htm /computer_science_tutorials.htm /database_tutorials.htm /devops_tutorials.htm /digital_marketing_tutorials.htm /engineering_tutorials.htm /upsc_ias_exams.htm /famous_monuments.htm /gate_exams_tutorials.htm /latest_technologies.htm /machine_learning_tutorials.htm /mainframe_tutorials.htm /management_tutorials.htm /maths_tutorials.htm /microsoft_technologies_tutorials.htm /misc_tutorials.htm /mobile_development_tutorials.htm /java_technology_tutorials.htm /python_technologies_tutorials.htm /sap_tutorials.htm /scripting_lnaguage_tutorials.htm /selected_reading.htm /software_quality_tutorials.htm /soft_skill_tutorials.htm /telecom_tutorials.htm /upsc_ias_exams.htm /web_development_tutorials.htm /sports_tutorials.htm /xml_technologies_tutorials.htm /multi_language_tutorials.htm /questions_and_answers.htm javascript:void(0); https://www.tutorialspoint.com/index.htm https://www.tutorialspoint.com/tutorialslibrary.htm https://www.tutorialspoint.com/videotutorials/index.php https://www.tutorialspoint.com/questions/index.php https://store.tutorialspoint.com https://www.tutorialspoint.com/videotutorials/login.php https://www.tutorialspoint.com/tutorialslibrary.htm https://www.tutorialspoint.com/videotutorials/index.php https://store.tutorialspoint.com /beautiful_soup/index.htm /beautiful_soup/beautiful_soup_overview.htm /beautiful_soup/beautiful_soup_installation.htm /beautiful_soup/beautiful_soup_souping_the_page.htm /beautiful_soup/beautiful_soup_kinds_of_objects.htm /beautiful_soup/beautiful_soup_navigating_by_tags.htm /beautiful_soup/beautiful_soup_searching_the_tree.htm /beautiful_soup/beautiful_soup_modifying_the_tree.htm /beautiful_soup/beautiful_soup_encoding.htm /beautiful_soup/beautiful_soup_beautiful_objects.htm /beautiful_soup/beautiful_soup_parsing_only_section_of_a_document.htm /beautiful_soup/beautiful_soup_trouble_shooting.htm /beautiful_soup/beautiful_soup_quick_guide.htm /beautiful_soup/beautiful_soup_useful_resources.htm /beautiful_soup/beautiful_soup_discussion.htm /upsc_ias_exams.htm /developers_best_practices/index.htm /questions_and_answers.htm /effective_resume_writing.htm /hr_interview_questions/index.htm /computer_glossary.htm /computer_whoiswho.htm /beautiful_soup/beautiful_soup_pdf_version.htm /beautiful_soup/beautiful_soup_quick_guide.htm /beautiful_soup/beautiful_soup_useful_resources.htm /beautiful_soup/beautiful_soup_discussion.htm /beautiful_soup/index.htm javascript:printPage(); /beautiful_soup/beautiful_soup_overview.htm javascript:printPage(); javascript:void(0) javascript:void(0) javascript:void(0); javascript:void(0); javascript:void(0); javascript:void(0); /videotutorials/dashboard.php /videotutorials/userlogout.php /index.htm /about/index.htm /about/return_refund_policy.htm /about/about_terms_of_use.htm /about/about_privacy.htm /about/faq.htm /about/contact_us.htm
# Souping the Page
with open("./Beautiful Soup Tutorial - Tutorialspoint.html") as fp:
soup = BeautifulSoup(fp)
print(soup)
<!DOCTYPE html> <!-- saved from url=(0055)https://www.tutorialspoint.com/beautiful_soup/index.htm --><html lang="en-US"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/publishertag.prebid.js.download" type="text/javascript"></script><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/osd.js.download"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/bbplayer.js.download" type="text/javascript"></script><script type="text/javascript">!function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function e(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var _=function(){return(_=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var i=(o.prototype.isAdBlocked=function(e){var t=this;this.createPixel(o.allowedPixelUrl,function(){(t.allowedPixelLoaded=!0)===t.blockedPixelFailed&&e(!0)},function(){}),this.createPixel(o.blockedPixelUrl,function(){e(!1)},function(){(t.blockedPixelFailed=!0)===t.allowedPixelLoaded&&e(!0)})},o.prototype.createPixel=function(e,t,i){var n=document.createElement("img");n.src=e,n.height=1,n.width=1,n.style.display="none",n.onload=t,n.onerror=i},o.allowedPixelUrl="https://static.criteo.net/images/pixel.gif?ch=1",o.blockedPixelUrl="https://static.criteo.net/images/pixel.gif?ch=2",o);function o(){this.allowedPixelLoaded=!1,this.blockedPixelFailed=!1}var S=(t.create=function(e){return new t(e)},t.prototype.adBlockFlagEnabled=function(){var e=t.ADBLOCK_FLAG_KEY;return null!==this.localStorageHelper.getItem(e)},t.prototype.enableAdBlockFlag=function(){var e=t.ADBLOCK_FLAG_KEY;this.localStorageHelper.setItem(e,"1",t.ADBLOCK_FLAG_LIFETIME)},t.prototype.disableAdBlockFlag=function(){var e=t.ADBLOCK_FLAG_KEY;this.localStorageHelper.removeItem(e)},t.prototype.setAdBlockFlagTimer=function(e){var t=this;this.adBlockFlagEnabled()||!this.timerEnabled||this.timerStarted||(this.timerStarted=!0,setTimeout(function(){t.timerEnabled&&(t.refreshAdblockFlag(),t.timerEnabled=!1)},e))},t.prototype.disableAdBlockFlagTimer=function(){this.timerEnabled=!1,this.adBlockFlagEnabled()&&this.refreshAdblockFlag()},t.prototype.refreshAdblockFlag=function(){var t=this;(new i).isAdBlocked(function(e){e?t.enableAdBlockFlag():t.disableAdBlockFlag()})},t.ADBLOCK_FLAG_KEY="criteo_adblock_flag",t.ADBLOCK_FLAG_LIFETIME=864e5,t);function t(e){this.timerEnabled=!0,this.timerStarted=!1,this.localStorageHelper=e}function r(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var s,u,a,R=(e(d,s=function(){}),d.prototype.ResizeFrame=function(e,t){if(this.document.defaultView&&this.document.defaultView.frameElement){var i=this.document.defaultView.frameElement;i.width=e.toString(),i.height=t.toString()}},d.prototype.Write=function(e){this.document.open(),this.document.write(e),this.document.close()},d.prototype.LoadScript=function(e){this.Write("<script type='text/javascript' src='"+r(e)+"'><\/script>")},d);function d(e){var t=s.call(this)||this;return t.document=e,t}(a=u=u||{})[a.Error=0]="Error",a[a.Warning=1]="Warning",a[a.Debug=2]="Debug";var c=["color: #fff;","background: #ff8f1c;","display: inline-block;","padding: 1px 4px;","border-radius: 3px;"].join(" "),M=(l.Log=function(e,t){if(!(l.LOGLEVEL<e)){var i=u[e].toUpperCase(),n=window.navigator.userAgent,o=0<n.indexOf("MSIE ")||0<n.indexOf("Trident/");window.console&&(o?console.log("[PubTag] "+i+": "+t):console.log("%cPubTag",c,i+": "+t))}},l.Debug=function(e){l.Log(u.Debug,e)},l.Warning=function(e){l.Log(u.Warning,e)},l.Error=function(e){l.Log(u.Error,e)},l.LOGLEVEL=u.Error,l);function l(){}var T=(p.prototype.filterNoBidSlots=function(e){var t=this.bidManager.filterNoBidSlots(e);return this.context.shouldIgnoreSilentMode?(t.length!==e.length&&this.context.setSilentModeIgnored&&this.context.setSilentModeIgnored(),e):t},p.prototype.silentModeEnabled=function(){var e=!1;return this.silentModeManager.silentModeEnabled()&&(this.context.shouldIgnoreSilentMode&&this.context.setSilentModeIgnored?this.context.setSilentModeIgnored():e=!0),e},p.prototype.getCachedBids=function(e){return this.bidManager.getRequestCachedBids(e)},p.prototype.removeBid=function(e){this.bidManager.removeBid(e)},p.prototype.handleResponse=function(e,t,i,n){var o=i.time_to_next_call;0<o&&(M.Debug("Global silent mode enabled for "+o+" seconds"),this.silentModeManager.enableSilentMode(1e3*o));var r={};if(i.slots)for(var s=0,a=i.slots;s<a.length;s++)(f=a[s]).ttl&&(r[f.imp_id]=f.ttl);var d=[];if(t.slots)for(var c=0,l=t.slots;c<l.length;c++){var u=0;(f=l[c]).slotid in r&&(u=r[f.slotid],delete r[f.slotid]),0<u&&(M.Debug("Bid for slot '"+f.impid+"' cached for "+u+" seconds"),d.push({slot:f,ttl:u}))}this.bidManager.storeResponseBids(d);var p=[];for(var h in r)if(r.hasOwnProperty(h))for(var v=0,g=e;v<g.length;v++){var f;(f=g[v]).slotId===h&&(u=r[h],M.Debug("Silent mode for slot '"+f.impId+"' enabled for "+u+" seconds"),p.push({slot:f,ttl:u}))}this.bidManager.storeRequestNoBids(p)},p.prototype.clearExpiredItems=function(){var e=this;setTimeout(function(){e.bidManager.clearExpiredItems()},3e3)},p);function p(e,t,i){this.silentModeManager=e,this.bidManager=t,this.context=i}var h=(v.prototype.eval=function(e){},v);function v(e){this.name=e}var g,f=(e(m,g=h),m.prototype.eval=function(e){this.callback&&this.callback.apply(this)},m.NAME="genericEvent",m);function m(e){var t=g.call(this,m.NAME)||this;return t.callback=e,t}var y=(C.prototype.generateRandomId=function(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,6)},C);function C(e,t,i,n,o,r,s){this.id=this.generateRandomId(),this.slotId=e,this.impressionId=t,this.cpm=i,this.width=n,this.height=o,this.zoneId=r,this.dealCode=s}var E,P=(e(w,E=y),w.prototype.GenerateEvent=function(e){var t=this;return e.ResizeFrame(this.width,this.height),new f(function(){return e.LoadScript(t.displayUrl)})},w.prototype.GenerateMessage=function(){return{displayUrl:this.displayUrl}},w);function w(e,t,i,n,o,r,s,a){var d=E.call(this,e,t,i,n,o,r,a)||this;return d.displayUrl=s,d}var b,x=(e(I,b=y),I.prototype.GenerateEvent=function(e){var t=this;return e.ResizeFrame(this.width,this.height),new f(function(){return e.Write(t.creative)})},I.prototype.GenerateMessage=function(){return{creative:this.creative}},I);function I(e,t,i,n,o,r,s,a){var d=b.call(this,e,t,i,n,o,r,a)||this;return d.creative=s,d}var A,D=(e(O,A=y),O.prototype.GenerateEvent=function(e){var t=this;return"function"!=typeof this.nativeCallback?(M.Error("'nativeCallback' parameter is not a function in placements object"),new f(void 0)):"object"!=typeof this.nativePayload?(M.Error("'nativePayload' parameter is not an object in placements object"),new f(void 0)):new f(function(){return t.nativeCallback(t.nativePayload)})},O.prototype.GenerateMessage=function(){return{nativePayload:this.nativePayload}},O);function O(e,t,i,n,o,r,s,a,d){var c=A.call(this,e,t,i,n,o,r,d)||this;return c.nativeCallback=s,c.nativePayload=a,c}var k=(B.prototype.getMetricsManager=function(){return this.metricsManager},B.prototype.withElapsed=function(e){return this.elapsed=Math.round(e),this},B.prototype.withIsTimeout=function(e){return(this.isTimeout=e)&&this.events.push({eventId:"CdbCallTimeout"}),this},B.prototype.withAdapterStartElapsed=function(e){return this.adapterStartElapsed=Math.round(e),this.events.push({eventId:"AdapterBidStart",elapsed:this.adapterStartElapsed}),this},B.prototype.withCdbCallStartElapsed=function(e){return this.cdbCallStartElapsed=Math.round(e),this.events.push({eventId:"CdbCallStart",elapsed:this.cdbCallStartElapsed}),this},B.prototype.withCdbCallEndElapsed=function(e){return this.cdbCallEndElapsed=Math.round(e),this.events.push({eventId:"CdbCallEnd",elapsed:this.cdbCallEndElapsed}),this},B.prototype.withAdapterEndElapsed=function(e){return this.adapterEndElapsed=Math.round(e),this.events.push({eventId:"AdapterBidEnd",elapsed:this.adapterEndElapsed}),this},B.prototype.withAdapterTimeout=function(e){return this.adapterTimeout=e&&Math.round(e),this},B.prototype.withSlotIdsMatchedByCache=function(e){return 0<(this.slotIdsMatchedByCache=e).length&&this.events.push({eventId:"CachedBidUsed",slots:this.slotIdsMatchedByCache}),this},B.prototype.withTimeToFirstByte=function(e){return this.timeToFirstByte=e&&Math.round(e),this.timeToFirstByte&&this.events.push({eventId:"TimeToFirstByte",elapsed:this.timeToFirstByte}),this},B.prototype.withConnectionEstablishmentTime=function(e){return this.connectionEstablishmentTime=e&&Math.round(e),this.connectionEstablishmentTime&&this.events.push({eventId:"TcpConnectionElapsedTime",elapsed:this.connectionEstablishmentTime}),this},B.prototype.withDomainLookupTime=function(e){return this.domainLookupTime=e&&Math.round(e),this.domainLookupTime&&this.events.push({eventId:"DomainLookupElapsedTime",elapsed:this.domainLookupTime}),this},B.prototype.withUserPreviousTimestamp=function(e){return e&&this.events.push({eventId:"UserReturnTime",elapsed:(new Date).getTime()-e}),this},B.prototype.buildEvents=function(e){if(this.events.length){var t={requestId:e,events:this.events};return void 0!==this.adapterTimeout&&this.adapterEndElapsed>this.adapterTimeout&&t.events.push({eventId:"AdapterTimeout"}),t}},B.prototype.clear=function(){this.events=[]},B);function B(e){this.elapsed=0,this.isTimeout=!1,this.adapterStartElapsed=0,this.cdbCallStartElapsed=0,this.cdbCallEndElapsed=0,this.adapterEndElapsed=0,this.slotIdsMatchedByCache=[],this.events=[],this.metricsManager=e}function F(e){try{return JSON.parse(e)}catch(e){return}}var U,N,L=(H.generateCacheBuster=function(){return Math.floor(99999999999*Math.random())},H);function H(){}function q(e){switch(e.toLowerCase()){case"amp":return U.AMP;default:return U.Unspecified}}(N=U=U||{})[N.Unspecified=0]="Unspecified",N[N.AMP=1]="AMP";var W=106,K=(z.prototype.buildUrl=function(e,t,i,n,o){void 0===i&&(i=U.Unspecified);var r=z.CRITEO_BIDDER_URL+this.getHandlerPath();return r+="?ptv="+W,!0===t.isAdBlocked&&(r+="&abp=1"),r=this.appendCommonParameters(r,e,n,o),r+=t.ctoIdOnPublisherDomain?"&idcpy="+t.ctoIdOnPublisherDomain:"",r+=t.secureId?"&sid="+t.secureId:"",r+=t.isOptOut?"&optout=1":"",r+=t.bundle?"&bundle="+t.bundle:"",i!==U.Unspecified&&(r+="&im="+i),r+=t.silentModeIgnored?"&smi=1":"",r+="&cb="+String(L.generateCacheBuster()),r+=t.getContextFlags()},z.prototype.buildErrorUrl=function(){return z.CRITEO_BIDDER_URL+z.CRITEO_ERROR_HANDLER},z.prototype.buildCsmEventsUrl=function(){return z.CRITEO_BIDDER_URL+z.CRITEO_CSM_EVENTS_HANDLER},z.prototype.buildCsmCountersUrl=function(){return z.CRITEO_BIDDER_URL+z.CRITEO_CSM_COUNTERS_HANDLER},z.prototype.appendCommonParameters=function(e,t,i,n){return e+="&profileId="+String(t),void 0!==i&&(e+="&av="+String(i)),void 0!==n&&(e+="&wv="+encodeURIComponent(n)),e},z.prototype.getHandlerPath=function(){return this.auditMode?z.CRITEO_BIDDER_AUDIT_HANDLER:z.CRITEO_BIDDER_HANDLER},z.CRITEO_BIDDER_URL="https://bidder.criteo.com/",z.CRITEO_BIDDER_HANDLER="cdb",z.CRITEO_CSM_HANDLER="csm",z.CRITEO_CSM_EVENTS_HANDLER="csm/events",z.CRITEO_CSM_COUNTERS_HANDLER="csm/counters",z.CRITEO_ERROR_HANDLER="error",z.CRITEO_BIDDER_AUDIT_HANDLER="prebid/audit",z);function z(e){void 0===e&&(e=!1),this.auditMode=e}var G=(V.prototype.sendEventsToBeacon=function(e,t){navigator.sendBeacon&&e&&navigator.sendBeacon(t,JSON.stringify(e))},V);function V(){this.urlBuilder=new K}var Y,j=(e(J,Y=G),J.prototype.getManagerMetrics=function(){var e=this.localStorageHelper.getItem(J.MANAGER_METRICS_STORAGE_KEY);if(null==e)return{};var t=F(e);return void 0===t?{}:t},J.prototype.setManagerMetrics=function(e){this.localStorageHelper.setItem(J.MANAGER_METRICS_STORAGE_KEY,JSON.stringify(e))},J.prototype.getSilentModeRequestCount=function(e){void 0===e&&(e=!1);var t=this.getManagerMetrics().silentModeRequestCount;return e&&this.resetSilentModeRequestCount(),isNaN(t)?0:t},J.prototype.incSilentModeRequestCount=function(){var e=this.getManagerMetrics();e.silentModeRequestCount=isNaN(e.silentModeRequestCount)?1:e.silentModeRequestCount+1,this.setManagerMetrics(e)},J.prototype.resetSilentModeRequestCount=function(){var e=this.getManagerMetrics();e.silentModeRequestCount=0,this.setManagerMetrics(e)},J.prototype.getLocalStorageKeyCount=function(){return this.localStorageHelper.getAllItemsByPrefix("criteo_").length+this.localStorageHelper.getAllItemsByPrefix("cto_").length},J.prototype.getPreviousBuildRequestTimestamp=function(){var e=this.getManagerMetrics().previousBuildRequestTimestamp;return isNaN(e)?void 0:e},J.prototype.resetPreviousBuildRequestTimestamp=function(){var e=this.getManagerMetrics();e.previousBuildRequestTimestamp=(new Date).getTime().toString(),this.setManagerMetrics(e)},J.prototype.sendEvents=function(e,t,i){void 0===i&&(i=!1),i&&(e.withUserPreviousTimestamp(this.getPreviousBuildRequestTimestamp()),this.resetPreviousBuildRequestTimestamp()),this.sendEventsToBeacon(e.buildEvents(t),this.urlBuilder.buildCsmEventsUrl()),e.clear()},J.MANAGER_METRICS_STORAGE_KEY="criteo_pt_cdb_mngr_metrics",J);function J(e){var t=Y.call(this)||this;return t.localStorageHelper=e,t}var X=(Z.tryInsertPlaceholder=function(e,t,i){var n=document.getElementById(e);if(null===n)return M.Warning("Unable to insert ad placeholder : impression id "+e+" not found."),!1;if(n.appendChild(this.createPlaceholder()),!t&&this.isVisible(n))return!0;this.removePlaceholder(e,i);var o=n.parentElement;if(null===o)return!1;var r=this.createClone(n);return o.insertBefore(r,n),r.appendChild(this.createPlaceholder()),this.isVisible(r)?(i[e]=r,!0):(M.Warning("Ad placeholder created but not visible : can't render."),o.removeChild(r),!1)},Z.isVisible=function(e){return 0!==e.offsetWidth&&0!==e.offsetHeight&&0!==e.getClientRects().length},Z.createClone=function(e){var t=e.cloneNode(!1);return t.id=this.generateRandomId(),t.className="","none"===t.style.display&&t.style.removeProperty("display"),"SPAN"===t.tagName&&(t.style.display="block"),e.style.display="none",t},Z.generateRandomId=function(){for(var e="1234567890abcdefghijklmnopqrstuvwxyz",t="",i=0;i<20;i++){var n=Math.floor(Math.random()*e.length);t+=e.charAt(n)}return t},Z.createPlaceholder=function(){var e=document.createElement("div");return e.style.width="1px",e.style.height="1px",e.style.display="block",e.className=Z.PLACEHOLDER_NAME,e},Z.removePlaceholder=function(e,t){var i=t[e];void 0!==i&&null!==i.parentNode&&i.parentNode.removeChild(i);var n=document.getElementById(e);if(null!==n)for(var o=0,r=n.getElementsByClassName(Z.PLACEHOLDER_NAME);o<r.length;o++){var s=r[o];null!==s.parentNode&&s.parentNode.removeChild(s)}},Z.insertAdIFrame=function(e,t){var i,n=t[e];if(void 0!==n)i=n;else{var o=document.getElementById(e);if(null===o)return null;i=o}for(var r=0,s=i.getElementsByClassName(Z.PLACEHOLDER_NAME);r<s.length;r++){for(var a=s[r],d=0,c=a.childNodes;d<c.length;d++){var l=c[d];null!==l.parentNode&&l.parentNode.removeChild(l)}var u=this.createAdIFrame();return a.appendChild(u),a.style.width="",a.style.height="",a.style.display="",u}return null},Z.createAdIFrame=function(){var e=document.createElement("iframe");return e.scrolling="no",e.marginWidth="0",e.marginHeight="0",e.frameBorder="0",e.style.border="0",e.style.verticalAlign="bottom",e},Z.removePlaceholders=function(e,t,i){for(var n=0,o=e;n<o.length;n++){var r=o[n].impId;-1===t.indexOf(r)&&Z.removePlaceholder(r,i)}},Z.tryInsertPlaceholders=function(e,t,i){for(var n=[],o=0,r=e;o<r.length;o++){var s=r[o],a=s.impId;Z.tryInsertPlaceholder(a,t,i)&&n.push(s)}return n},Z.PLACEHOLDER_NAME="criteo_placeholder",Z);function Z(){}var Q=($.prototype.isValid=function(){return 0<this.slots.length},$.prototype.getRequest=function(){for(var e=[],t=0,i=this.slots;t<i.length;t++){var n=i[t],o={slotid:n.slotId,impid:n.impId};if(void 0!==n.zoneId&&(o.zoneid=n.zoneId),void 0!==n.nativeCallback&&(o.native=!0),void 0!==n.transactionId&&(o.transactionid=n.transactionId),void 0!==n.publisherSubId&&(o.publishersubid=n.publisherSubId),void 0!==n.sizes){for(var r=[],s=0,a=n.sizes;s<a.length;s++){var d=a[s];r.push(d.width+"x"+d.height)}o.sizes=r}if(void 0!==n.video){var c={playersizes:this.parsePlayerSizes(n.video.playersize),mimes:n.video.mimes,protocols:n.video.protocols,maxduration:n.video.maxduration,api:n.video.api,skip:n.video.skip,placement:n.video.placement,playbackmethod:n.video.playbackmethod,minduration:n.video.minduration,startdelay:n.video.startdelay};o.video=c}if(void 0!==this.viewportComputer){var l=this.viewportComputer.getSlotPosition(n);void 0!==l&&(o.position={top:l.top,left:l.left})}void 0!==n.ext&&(o.ext=n.ext),e.push(o)}var u={ceh:this.context.ceh,uspOptout:this.context.ccpaOptout,ext:this.context.getUserExtWithContextualData()},p={publisher:{url:this.context.highestAccessibleUrl,ext:this.context.getPublisherExt()},slots:e,user:u};if(void 0!==this.networkId&&(p.publisher.networkid=this.networkId),this.privacyWrapper&&(this.privacyWrapper.gdprConsent&&(p.gdprConsent=this.privacyWrapper.gdprConsent),this.privacyWrapper.ccpaIabConsent&&(u.uspIab=this.privacyWrapper.ccpaIabConsent.uspString)),void 0!==this.viewportComputer){var h=this.viewportComputer.getViewport();p.viewport={width:h.width,height:h.height,scrollTop:h.scrollTop,scrollLeft:h.scrollLeft}}return void 0!==this.adapterTimeout&&(p.tmax=this.adapterTimeout),void 0!==this.auctionStart&&(p.auctionStart=this.auctionStart),void 0!==this.clientRequestId&&(p.id=this.clientRequestId),void 0!==this.userIds&&(p.eids=this.userIds),p},$.parsePlayerSize=function(e){return e[0]+"x"+e[1]},$.prototype.parsePlayerSizes=function(e){return Array.isArray(e[0])?e.map(function(e){return $.parsePlayerSize(e)}):[$.parsePlayerSize(e)]},$.prototype.getUrl=function(){return this.urlBuilder.buildUrl(this.profileId,this.context,this.integrationMode,this.adapterVersion,this.wrapperVersion)},$);function $(e,t,i,n,o,r,s,a,d,c,l,u,p,h){this.slots=e,this.context=t,this.urlBuilder=i,this.profileId=n,this.integrationMode=o||U.Unspecified,this.networkId=r,this.adapterVersion=s,this.privacyWrapper=a,this.wrapperVersion=d,this.viewportComputer=c,this.adapterTimeout=l,this.clientRequestId=u,this.userIds=p,this.auctionStart=h}function ee(e){var t={slots:void 0,time_to_next_call:0};return void 0!==e.exd&&(void 0!==e.exd.time_to_next_call&&(t.time_to_next_call=e.exd.time_to_next_call),t.slots=e.exd.slots,delete e.exd),t}function te(){var i=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?t:3&t|8).toString(16)})}var ie=function(e,t,i,n,o,r,s,a,d){this.slotId=te().replace(/-/g,""),this.impId=e,this.zoneId=t,this.nativeCallback=i,this.transactionId=n,this.sizes=o,this.publisherSubId=r,this.mediaTypes=s,this.video=a,this.ext=d},ne=function(e,t,i,n,o,r,s,a,d,c){this.playersize=e,this.mimes=t,this.protocols=i,this.maxduration=n,this.api=o,this.skip=r,this.placement=s,this.playbackmethod=a,this.minduration=d,this.startdelay=c},oe=(re.CreateRunning=function(){var e=new re;return e.start(),e},re.CreateWithStartTime=function(e){var t=new re(!1);return t.startTime=e,t},re.TimeSincePageLoad=function(){if(window.performance){if(window.performance.now)return window.performance.now();if(window.performance.timing&&window.performance.timing.navigationStart)return(new Date).getTime()-performance.timing.navigationStart}return 0},re.prototype.start=function(){this.startTime=this.now()},re.prototype.elapsed=function(){return this.now()-this.startTime},re);function re(e){void 0===e&&(e=!0),e&&window.performance&&window.performance.now?this.now=window.performance.now.bind(window.performance):Date.now?this.now=Date.now:this.now=function(){return(new Date).getTime()}}var se=(ae.prototype.sendRequest=function(e){this.url=e,this.sendTime=oe.CreateRunning(),this.builder.withCdbCallStartElapsed(this.timer.elapsed())},ae.prototype.requestReceived=function(e){void 0===e&&(e=!1),this.builder.withElapsed(function(e){if(window.performance&&window.performance.getEntries)for(var t=window.performance.getEntries(),i=t.length-1;0<=i;--i){var n=t[i];if(n.name===e&&n.duration)return Math.round(n.duration)}}(this.url)||this.sendTime.elapsed()),this.builder.withCdbCallEndElapsed(this.timer.elapsed()),this.builder.withIsTimeout(e)},ae.prototype.finish=function(){this.builder.withAdapterEndElapsed(this.timer.elapsed());var e=ae.getLastCdbTiming();void 0!==e&&(this.builder.withTimeToFirstByte(ae.computeTimeToFirstByte(e)),this.builder.withConnectionEstablishmentTime(ae.computeConnectionEstablishmentTime(e)),this.builder.withDomainLookupTime(ae.computeDomainLookupTime(e)))},ae.getLastCdbTiming=function(){if(void 0!==window.performance&&void 0!==window.performance.getEntriesByType&&"function"==typeof window.performance.getEntriesByType){var e=window.performance.getEntriesByType("resource");if(void 0!==e){var t=e.filter(function(e){return 0<=e.name.indexOf("cdb")});return void 0!==t&&0<t.length?t[t.length-1]:void 0}}},ae.computeTimeToFirstByte=function(e){var t=e.responseStart,i=e.requestStart;if(void 0!==t&&void 0!==i)return t-i},ae.computeConnectionEstablishmentTime=function(e){var t=e.connectEnd-e.connectStart;return isNaN(t)?void 0:t},ae.computeDomainLookupTime=function(e){var t=e.domainLookupEnd-e.domainLookupStart;return isNaN(t)?void 0:t},ae);function ae(e,t,i){this.builder=e,this.timer=void 0!==t?oe.CreateWithStartTime(t):oe.CreateRunning();var n=this.timer.elapsed();this.builder.withAdapterStartElapsed(n),void 0!==i&&this.builder.withAdapterTimeout(i)}var de=(ce.prototype.toString=function(){return this.width+"x"+this.height},ce);function ce(e,t){this.width=e,this.height=t}function le(e){var t="number"==typeof window.PREBID_TIMEOUT?window.PREBID_TIMEOUT:void 0;return e&&t?Math.min(e,t):e||t||void 0}var ue=function(e,t){this.top=e,this.left=t},pe=function(e,t,i,n){this.width=e,this.height=t,this.scrollTop=i,this.scrollLeft=n},he=(ve.getHighestAccessibleWindow=function(e){var t=e,i=!1;try{for(;t.parent.document!==t.document;){if(!t.parent.document){i=!0;break}t=t.parent}}catch(e){i=!0}return{topFrame:t,err:i}},ve.getHighestAccessibleUrl=function(e){var t=e.topFrame;if(!e.err)return t.location.href;try{var i=t.top.location.href;if(i)return i}catch(e){}try{var n=t.location.ancestorOrigins;if(n)return n[n.length-1]}catch(e){}return t.document.referrer},ve.inIframe=function(){try{return window.self!==window.top}catch(e){return!0}},ve);function ve(){}var ge=(fe.prototype.getViewport=function(){var e=he.getHighestAccessibleWindow(window).topFrame,t=e.document,i=e.innerWidth||t.documentElement.clientWidth,n=e.innerHeight||t.documentElement.clientHeight,o=t.documentElement.scrollTop||t.body&&t.body.scrollTop||0,r=t.documentElement.scrollLeft||t.body&&t.body.scrollLeft||0;return new pe(i,n,o,r)},fe.prototype.getSlotPosition=function(e){var t=e.impId,i=document.getElementById(t);if(null!==i){var n=i.getBoundingClientRect();return new ue(n.top,n.left)}},fe);function fe(){}var me=(ye.prototype.checkLocalStorage=function(e){if(!this.localStorage)return!1;var t=this.CHECK_STORAGE_KEY;try{return this.localStorage.setItem(t,t),this.localStorage.removeItem(t),!!this.checkTcfPurposeOne(e)||(M.Debug("Purpose One not granted"),!1)}catch(e){return!1}},ye.prototype.checkTcfPurposeOne=function(e){return!e||!e.purposes||!0===e.purposes[1]},ye.prototype.removeItem=function(e){this.localStorageEnabled&&(this.localStorage.removeItem(e),this.localStorage.removeItem(e+this.EXPIRE_SUFFIX))},ye.prototype.getItem=function(e,t){if(!this.localStorageEnabled)return null;var i=(new Date).getTime(),n=this.localStorage.getItem(e+this.EXPIRE_SUFFIX),o=n?parseInt(n,10):-1;return-1!==o&&o<i||t&&(-1===o||t<o-i)?(this.removeItem(e),null):this.localStorage.getItem(e)},ye.prototype.setItem=function(e,t,i){if(this.localStorageEnabled)try{if(this.localStorage.setItem(e,t),i){var n=(new Date).getTime()+i;this.localStorage.setItem(e+this.EXPIRE_SUFFIX,n.toString())}}catch(e){}},ye.prototype.getAllItemsByPrefix=function(e){var t=[];if(this.localStorageEnabled)for(var i in localStorage)0===i.indexOf(e)&&t.push(i);return t},ye);function ye(e,t){this.EXPIRE_SUFFIX="_expires",this.CHECK_STORAGE_KEY="criteo_localstorage_check",this.localStorage=function(e){try{return e.localStorage}catch(e){return}}(e||window),this.localStorageEnabled=this.checkLocalStorage(t)}var Ce=(Ee.prototype.silentModeEnabled=function(){var e=Ee.SILENT_MODE_KEY;return null!==this.localStorageHelper.getItem(e)},Ee.prototype.enableSilentMode=function(e){var t=Ee.SILENT_MODE_KEY;this.localStorageHelper.setItem(t,"1",e)},Ee.SILENT_MODE_KEY="criteo_silent_mode",Ee);function Ee(e){this.localStorageHelper=e}function we(){return(new Date).getTime()}var be=(Ie.prototype.toString=function(){return"ImpId"+this.impressionId},Ie);function Ie(e){this.impressionId=e}var _e,Se=(e(Te,_e=be),Te.prototype.toString=function(){return _e.prototype.toString.call(this)+"_Size"+this.size+"_NetworkId"+this.networkId},Te);function Te(e,t,i){var n=_e.call(this,e)||this;return n.size=t,n.networkId=i,n}var Ae,Re=(e(Me,Ae=be),Me.prototype.toString=function(){return Ae.prototype.toString.call(this)+"_ZoneId"+this.zoneId},Me);function Me(e,t){var i=Ae.call(this,e)||this;return i.zoneId=t,i}var Pe=(xe.prototype.createKeysFromSlotRequest=function(e){if(this.useZoneIdIntegration)return[new Re(e.impId,e.zoneId)];for(var t=[],i=0,n=e.sizes;i<n.length;i++){var o=n[i];t.push(new Se(e.impId,o,this.networkId))}return t},xe.prototype.createKeyFromSlotResponse=function(e){return this.useZoneIdIntegration?new Re(e.impid,e.zoneid):new Se(e.impid,new de(e.width,e.height),this.networkId)},xe.prototype.createKeyFromBid=function(e){return this.useZoneIdIntegration?new Re(e.impressionId,e.zoneId):new Se(e.impressionId,new de(e.width,e.height),this.networkId)},xe);function xe(e,t){this.useZoneIdIntegration=e,this.networkId=t}var De=(Oe.useZoneIdIntegration=function(e,t){return void 0===t||0===e.filter(function(e){return void 0!==e.sizes&&0<e.sizes.length}).length},Oe.prototype.getBySlotKey=function(e,t){var i=t.toString();if(i in e){var n=e[i];if(void 0!==n)return void 0!==n.bid&&void 0!==n.expiration&&n.expiration<we()&&(n.bid=void 0,n.expiration=void 0),n}return{}},Oe.prototype.setBySlotKey=function(e,t,i){var n=t.toString();void 0!==i.bid||void 0!==i.expiration&&i.expiration>we()?e[n]=i:n in e&&delete e[n]},Oe.prototype.filterNoBidSlots=function(e){for(var t=[],i=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),n=i&&F(i)||{},o=0,r=e;o<r.length;o++){for(var s=r[o],a=[],d=0,c=this.slotKeyFactory.createKeysFromSlotRequest(s);d<c.length;d++){var l=c[d];this.getBidFromMap(n,l,0)!==Oe.NO_BID&&(l instanceof Se?a.push(l.size):t.push(s))}0<a.length&&(s.sizes=a,t.push(s))}return t},Oe.prototype.getRequestCachedBids=function(e,t){void 0===t&&(t=5e3);for(var i={},n=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),o=n&&F(n)||{},r=0,s=e;r<s.length;r++)for(var a=s[r],d=0,c=this.slotKeyFactory.createKeysFromSlotRequest(a);d<c.length;d++){var l=c[d],u=this.getBidFromMap(o,l,t);void 0!==u&&u!==Oe.NO_BID&&(i[a.slotId]=u)}return this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(o)),i},Oe.prototype.getBid=function(e,t){void 0===t&&(t=5e3);var i=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),n=i&&F(i)||{},o=this.getBidFromMap(n,e,t);return this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(n)),o},Oe.prototype.getBidFromMap=function(e,t,i){void 0===i&&(i=5e3);var n=this.getBySlotKey(e,t);return void 0===n.bid&&n.expiration&&n.expiration>we()?Oe.NO_BID:0<i&&void 0!==n.bid?(delete e[t.toString()],n.bid):void 0},Oe.prototype.storeResponseBids=function(e){for(var t=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),n=t&&F(t)||{},i=function(i){var e=o.slotKeyFactory.createKeyFromSlotResponse(i.slot);o.modifyCache(n,e,function(e){var t=we()+1e3*i.ttl;(void 0===e.expiration||e.expiration<t)&&(e.bid=i.slot,e.expiration=t)})},o=this,r=0,s=e;r<s.length;r++)i(s[r]);this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(n))},Oe.prototype.storeRequestNoBids=function(e){for(var t=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),o=t&&F(t)||{},i=function(t){for(var e=0,i=r.slotKeyFactory.createKeysFromSlotRequest(t.slot);e<i.length;e++){var n=i[e];r.modifyCache(o,n,function(e){e.bid=void 0,e.expiration=Math.max(e.expiration||0,we()+1e3*t.ttl)})}},r=this,n=0,s=e;n<s.length;n++)i(s[n]);this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(o))},Oe.prototype.removeBid=function(t){var e=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),i=e&&F(e)||{},n=this.slotKeyFactory.createKeyFromBid(t);this.modifyCache(i,n,function(e){void 0!==e.bid&&e.bid.slotid===t.slotId&&(e.bid=void 0,e.expiration=void 0)}),this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(i))},Oe.prototype.modifyCache=function(e,t,i){var n=this.getBySlotKey(e,t);i(n),this.setBySlotKey(e,t,n)},Oe.prototype.clearExpiredItems=function(){for(var e=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),t=e&&F(e)||{},i=0,n=Object.keys(t);i<n.length;i++){var o=n[i],r=t[o];void 0!==r&&void 0!==r.expiration&&r.expiration<we()&&delete t[o]}this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(t))},Oe.NO_BID="nobid",Oe.BIDCACHE_STORAGE_KEY="criteo_pt_cdb_bidcachemap",Oe);function Oe(e,t,i){this.localStorageHelper=e,this.slotKeyFactory=new Pe(t,i)}var ke=(Be.prototype.send=function(e,t,i,n){var o=void 0!==this.data?"POST":"GET",r=this.getXMLHttpRequest(o,e,t,i,n);if(void 0!==r)r.send(this.data);else{var s=this.getXDomainRequest(o,e,t,i,n);void 0!==s&&s.send(this.data)}},Be.prototype.getXMLHttpRequest=function(e,t,i,n,o){var r=new XMLHttpRequest;if("withCredentials"in r)return r.open(e,this.url,!0),r.timeout=o||Be.LOCAL_PASSBACK_TIMEOUT,this.contentType?r.setRequestHeader("Content-type",this.contentType):"POST"===e&&r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.withCredentials=this.withCredentials,r.onload=function(){4===r.readyState&&200===r.status?t(r.responseText):i(r.readyState,r.status)},r.onerror=function(){i(void 0,void 0)},n&&(r.ontimeout=n),r},Be.prototype.getXDomainRequest=function(e,t,i,n,o){if("undefined"!=typeof XDomainRequest){var r=new XDomainRequest;return r.timeout=o||Be.LOCAL_PASSBACK_TIMEOUT,r.open(e,this.url),r.onload=function(){void 0!==r.responseText?t(r.responseText):i(void 0,void 0)},r.onerror&&(r.onerror=function(){i(void 0,void 0)}),r.ontimeout&&n&&(r.ontimeout=n),r}},Be.LOCAL_PASSBACK_TIMEOUT=3e4,Be);function Be(e,t,i,n){void 0===n&&(n=!0),this.url=e,this.data=t,this.contentType=i,this.withCredentials=n}var Fe=(Ue.prototype.retrievePixels=function(e,t,i){var n=this;new ke(this.getUserSyncUrl(e,t,i)).send(function(e){if(e){var t=Ue.parseUserSyncResponse(e);t?n.onPixelsRetrieved(t):n.errorReporter.log("Error","Unable to parse response from user sync")}},function(e,t){M.Warning("User Sync Pixel endpoint error; readyState "+e+"; requestStatus "+t)},function(){M.Warning("User Sync Pixel endpoint timeout")},this.pixelSyncTimeout)},Ue.prototype.getUserSyncUrl=function(e,t,i){var n=[];return(null==e?void 0:e.consentData)&&n.push("gdpr="+e.consentData),(null==e?void 0:e.gdprApplies)&&n.push("gdprapplies="+e.gdprApplies),(null==t?void 0:t.uspString)&&n.push("ccpa="+t.uspString),(null==i?void 0:i.country_code)&&n.push("countrycode="+i.country_code),this.debug&&n.push("debug=1"),this.pixelSyncEndpoint+(n.length?"?"+n.join("&"):"")},Ue.parseUserSyncResponse=function(e){var t=F(e);return t?("pixels"in t?Array.isArray(t.pixels)?t.pixels=t.pixels.filter(function(t){try{return new URL(t),!0}catch(e){return M.Warning("Failed to parse User Sync Pixel URL: "+t),!1}}):(M.Warning("pixels field in user sync response is not an array: "+t.pixels),t.pixels=[]):t.pixels=[],t):void M.Warning("Failed to parse user sync pixel JSON payload")},Ue);function Ue(e,t,i){void 0===i&&(i=!1),this.pixelSyncEndpoint="https://3pd.criteo.com/user-sync/pixels",this.pixelSyncTimeout=2e3,this.errorReporter=t,this.onPixelsRetrieved=e,this.debug=i}var Ne=(Le.execUserSync=function(e,t,i,n,o){void 0===o&&(o=!1),new Fe(Le.appendUserSyncPixels,e,o).retrievePixels(t,i,n)},Le.getOrCreateTagContainer=function(){var e=document.getElementById(Le.tagElementName);if(e)return e;var t=document.createElement("div");return t.setAttribute("id",Le.tagElementName),t.style.display="none",document.body.appendChild(t),t},Le.appendUserSyncPixels=function(e){if(e.pixels.length)for(var t=Le.getOrCreateTagContainer(),i=0,n=e.pixels;i<n.length;i++){var o=n[i],r=new Image;r.src=o,t.appendChild(r)}},Le.tagElementName="criteoUserSyncTagsContainer",Le);function Le(){}var He,qe;(qe=He=He||{}).Native="native",qe.Banner="banner",qe.Video="video";var We=(Ke.prototype.hasValidNativeParams=function(e){return!(e.nativeParams&&(e.nativeParams.image&&(!0!==e.nativeParams.image.sendId||!0===e.nativeParams.image.sendTargetingKeys)||e.nativeParams.icon&&(!0!==e.nativeParams.icon.sendId||!0===e.nativeParams.icon.sendTargetingKeys)||e.nativeParams.clickUrl&&(!0!==e.nativeParams.clickUrl.sendId||!0===e.nativeParams.clickUrl.sendTargetingKeys)||e.nativeParams.displayUrl&&(!0!==e.nativeParams.displayUrl.sendId||!0===e.nativeParams.displayUrl.sendTargetingKeys)||e.nativeParams.privacyLink&&(!0!==e.nativeParams.privacyLink.sendId||!0===e.nativeParams.privacyLink.sendTargetingKeys)||e.nativeParams.privacyIcon&&(!0!==e.nativeParams.privacyIcon.sendId||!0===e.nativeParams.privacyIcon.sendTargetingKeys)))},Ke.prototype.buildCdbUrl=function(){return this.url},Ke.prototype.buildCdbRequest=function(){if(this.cache.silentModeEnabled())return M.Debug("Request ignored because the global silent mode is enabled"),void this.metricsManager.incSilentModeRequestCount();if(this.requestBuilder.isValid()){var e=Math.min((this.timeout||5e3)+1e3,5e3);return this.adBlockFlagManager.setAdBlockFlagTimer(e),this.timer.sendRequest(this.url),this.requestBuilder.getRequest()}M.Debug("Request ignored because it doesnt contain any slot")},Ke.GetAllAdapters=function(){return(window.Criteo_prebid_106||window.Criteo).prebid_adapters},Ke.GetAdapter=function(e){var t="string"==typeof e?e:e.bidRequests[0].auctionId,i=Ke.GetAllAdapters();if(i&&t in i)return i[t]},Ke.createCriteoNativeAdWithCallback=function(e,t,i){var n=r(e);return window.criteo_prebid_native_slots=window.criteo_prebid_native_slots||{},window.criteo_prebid_native_slots[n]={callback:i,payload:t},'<script type="text/javascript">\n var win = window;\n for (var i = 0; i < 10; ++i) {\n win = win.parent;\n if (win.criteo_prebid_native_slots) {\n var responseSlot = win.criteo_prebid_native_slots["'+n+'"];\n responseSlot.callback(responseSlot.payload);\n break;\n }\n }\n <\/script>'},Ke.createPrebidNativeAd=function(e){return{sendTargetingKeys:!1,title:e.products[0].title,body:e.products[0].description,sponsoredBy:e.advertiser.description,icon:e.advertiser.logo,image:e.products[0].image,clickUrl:e.products[0].click_url,privacyLink:e.privacy.optout_click_url,privacyIcon:e.privacy.optout_image_url,cta:e.products[0].call_to_action,price:e.products[0].price,impressionTrackers:e.impression_pixels.map(function(e){return e.url})}},Ke.prototype.getBidRequestForSlot=function(e){for(var t=0,i=this.bidRequests;t<i.length;t++){var n=i[t];if(n.adUnitCode===e.impid&&(!n.params.zoneId||parseInt(n.params.zoneId,10)===e.zoneid))return n}},Ke.prototype.getSlotForAdUnitCode=function(e){for(var t=0,i=this.slots;t<i.length;t++){var n=i[t];if(n&&n.impId===e)return n}},Ke.getVideoInfoFromBidRequest=function(e){if(Ke.hasVideoMediaType(e))return new ne(e.mediaTypes.video.playerSize,e.mediaTypes.video.mimes,e.mediaTypes.video.protocols,e.mediaTypes.video.maxduration,e.mediaTypes.video.api,e.params.video.skip,e.params.video.placement,e.params.video.playbackmethod,e.params.video.minduration,e.params.video.startdelay)},Ke.hasVideoMediaType=function(e){return void 0!==e.params&&void 0!==e.params.video&&!(void 0===e.mediaTypes||void 0===e.mediaTypes.video)},Ke.prototype.interpretResponse=function(e,t){var i=window.criteo_pubtag_prebid_106||window.criteo_pubtag;this.timer.requestReceived(),this.adBlockFlagManager.disableAdBlockFlagTimer();var n=ee(e),o={};if(void 0!==n.slots)for(var r=0,s=n.slots;r<s.length;r++)o[(w=s[r]).imp_id]=w;var a,d,c,l,u,p,h,v,g,f,m,y=[];if(e.slots&&Array.isArray(e.slots))for(var C=0,E=e.slots;C<E.length;C++){var w=E[C],b=this.getBidRequestForSlot(w);if(b)if(!0===i.context.isAdBlocked){if(void 0!==(a=w.slotid,d=w.impid,c=w.cpm,l=w.width,u=w.height,p=w.zoneid,h=b.params.nativeCallback,v=w.native,g=w.displayurl,f=w.creative,m=w.deal,A=void 0!==h&&void 0!==v?new D(a,d,c,l,u,p,h,v,m):void 0===g||void 0!==f&&"<script"!==f.substr(0,7)?void 0!==f?new x(a,d,c,l,u,p,f,m):void 0:new P(a,d,c,l,u,p,g,m))&&X.tryInsertPlaceholder(b.adUnitCode,!0,i.context.cloneByImpressionId)){var I=X.insertAdIFrame(b.adUnitCode,i.context.cloneByImpressionId);if(null!=I){var _=new R(I.contentDocument);A.GenerateEvent(_).eval(window.criteo_pubtag_prebid_106)}}}else{var S=b.bidId,T=w.ttl||o[w.slotid]&&o[w.slotid].ttl||60,A={requestId:S,adId:te(),cpm:w.cpm,currency:w.currency,netRevenue:!0,ttl:T,creativeId:S,width:w.width,height:w.height,dealId:w.deal};w.native?b.params.nativeCallback?A.ad=Ke.createCriteoNativeAdWithCallback(S,w.native,b.params.nativeCallback):(A.native=Ke.createPrebidNativeAd(w.native),A.mediaType=He.Native):w.video?(A.vastUrl=w.displayurl,A.mediaType=He.Video):A.ad=w.creative,y.push(A)}else M.Error("Unable to bid request for slot "+w)}return this.cache.handleResponse(this.slots,e,n,!1),this.timer.finish(),this.metricsManager.sendEvents(this.metricBuilder,this.clientRequestId,!0),this.cache.clearExpiredItems(),!0===e.user_sync&&Ne.execUserSync(i.context.remoteLogging,this.gdprConsent,this.ccpaIabConsent,e),y},Ke.prototype.handleBidWon=function(){},Ke.prototype.handleBidTimeout=function(){this.timer.requestReceived(!0),this.timer.finish(),this.metricsManager.sendEvents(this.metricBuilder,this.clientRequestId,!0),this.cache.clearExpiredItems()},Ke.prototype.handleSetTargeting=function(){},Ke.prototype.getBannerSizes=function(e){var t,i;return(null===(i=null===(t=e.mediaTypes)||void 0===t?void 0:t.banner)||void 0===i?void 0:i.sizes)||e.sizes||[]},Ke.prototype.getNativeSizes=function(e){var t,i,n;return(null===(n=null===(i=null===(t=e.mediaTypes)||void 0===t?void 0:t.native)||void 0===i?void 0:i.image)||void 0===n?void 0:n.sizes)||[]},Ke.prototype.getSizes=function(e){var t,i=this.getBannerSizes(e).map(function(e){return new de(e[0],e[1])}),n=this.getNativeSizes(e).map(function(e){return new de(e[0],e[1])}),o=i.concat(n);return(null===(t=e.mediaTypes)||void 0===t?void 0:t.native)&&(0===o.length?o=[new de(2,2)]:o.forEach(function(e,t,i){void 0===e.height&&void 0===e.width&&(i[t]=new de(2,2))})),o.filter(function(e,t,i){return i.indexOf(e)===t})},Ke.prototype.getFloorsForSizes=function(e,o,r){var s={},t=r.getFloor({currency:"USD",size:"*",mediaType:o});if("USD"!==t.currency)throw new Error("Currency for floors is not in USD, or cannot be converted to USD");return s["*"]=t.floor,e.forEach(function(e,t,i){var n=new de(e[0],e[1]);s[n.toString()]=r.getFloor({currency:"USD",size:e,mediaType:o}).floor}),s},Ke);function Ke(e,t,i,n,o){var r,s,a,d=window.criteo_pubtag_prebid_106||window.criteo_pubtag;this.clientRequestId=te(),this.gdprConsent={},n.gdprConsent&&(void 0!==n.gdprConsent.consentString&&(this.gdprConsent.consentData=n.gdprConsent.consentString),void 0!==n.gdprConsent.gdprApplies&&(this.gdprConsent.gdprApplies=!!n.gdprConsent.gdprApplies),this.gdprConsent.version=n.gdprConsent.apiVersion),this.ccpaIabConsent={uspString:n.uspConsent};var c=new me(void 0,this.gdprConsent);this.timeout=le(n.timeout),this.metricsManager=new j(c),this.metricBuilder=new k(this.metricsManager),this.timer=new se(this.metricBuilder,n.start,this.timeout);var l,u,p=new ge;this.adBlockFlagManager=S.create(c),this.adBlockFlagManager.adBlockFlagEnabled()&&(e=280,d.context.isAdBlocked=!0),this.auctionId=n.auctionId,this.bidRequests=i,this.slots=[];for(var h,v=!0,g=0,f=i;g<f.length;g++){var m=void 0;(w=f[g]).fpd&&w.fpd.context&&(m=w.fpd.context),w.params.ext&&(m=_(_({},m),w.params.ext)),v=this.hasValidNativeParams(w);try{var y={};if(w.getFloor&&((null===(r=w.mediaTypes)||void 0===r?void 0:r.banner)&&(y.banner=this.getFloorsForSizes(this.getBannerSizes(w),"banner",w)),(null===(s=w.mediaTypes)||void 0===s?void 0:s.native)&&(y.native=this.getFloorsForSizes(this.getNativeSizes(w),"native",w)),null===(a=w.mediaTypes)||void 0===a?void 0:a.video)){var C=w.mediaTypes.video.playerSize||[];y.video=0<C.length&&"number"==typeof C[0]?this.getFloorsForSizes([C],"video",w):this.getFloorsForSizes(C,"video",w)}Object.keys(y).length&&(m=_(_({},m),{floors:y}))}catch(e){M.Debug("Could not parse floors from Prebid: "+e)}this.slots.push(new ie(w.adUnitCode,w.params.zoneId,w.params.nativeCallback,w.transactionId,this.getSizes(w),w.params.publisherSubId,w.mediaTypes,Ke.getVideoInfoFromBidRequest(w),m)),l=w.params.networkId||l,h=n.ceh,(window.criteo_pubtag_prebid_106||window.criteo_pubtag).context.ceh=h,w.params.integrationMode&&(u=q(w.params.integrationMode))}v||M.Warning("All native assets containing URL should be sent as placeholders with sendId(icon, image, clickUrl, privacyLink, privacyIcon)");var E,w,b=new K(!1);0<i.length&&(w=i[0]).userIdAsEids&&0<w.userIdAsEids.length&&(E=w.userIdAsEids);"function"==typeof d.context.setPublisherExt&&"function"==typeof d.context.setUserExt?(d.context.setPublisherExt(n.publisherExt),d.context.setUserExt(n.userExt)):(d.context.publisherExt=n.publisherExt,d.context.userExt=n.userExt);var I=De.useZoneIdIntegration(this.slots,l);this.cache=new T(new Ce(c),new De(c,I,l),d.context),this.requestBuilder=new Q(this.cache.filterNoBidSlots(this.slots),d.context,b,e,u,l,t,{ccpaIabConsent:this.ccpaIabConsent,gdprConsent:this.gdprConsent},o,p,this.timeout,this.clientRequestId,E,n.start),this.url=this.requestBuilder.getUrl(),(window.Criteo_prebid_106||window.Criteo).prebid_adapters=(window.Criteo_prebid_106||window.Criteo).prebid_adapters||{},(window.Criteo_prebid_106||window.Criteo).prebid_adapters[this.auctionId]=this}function ze(e){try{return JSON.parse(e)}catch(e){return}}var Ge=(Ve.prototype.getCMPFrame=function(){for(var e,t=this.currentWindow,i=0;i<10;++i){try{t.frames.__uspapiLocator&&(e=t)}catch(e){}if(t===this.currentWindow.top)break;t=t.parent}return e},Ve.prototype.hasCallerFunctionInWindow=function(){return"function"==typeof this.currentWindow.__uspapi},Ve.prototype.readyToRetrieve=function(){return this.hasCallerFunctionInWindow()||void 0!==this.getCMPFrame()},Ve.prototype.retrieveConsent=function(i){var n=this,o=!1,r=window.setTimeout(function(){o=!0,n.logger("Timeout: Unable to resolve CCPA consent after "+n.timeout+"ms"),i(void 0)},this.timeout);this.executeCommand("getUSPData",1,function(e,t){o||(clearTimeout(r),t?(n.logger("CCPA consent retrieved"),n.processResponseData(e,i)):(n.logger("Error retrieving CCPA consent data from CMP"),i(void 0)))})},Ve.prototype.processResponseData=function(e,t){e?t(e):(this.logger("Unable to read CCPA consent data from CMP"),t(void 0))},Ve.prototype.executeCommand=function(e,t,i){var r=this;if(!this.hasCallerFunctionInWindow()){this.logger("No CCPA CMP defined on current frame");var s=this.getCMPFrame();this.currentWindow.__uspapi=function(e,t,i){if(!s)return r.logger("CCPA CMP not found in any frame"),void i({msg:"CCPA CMP not found in any frame"},!1);var n=Math.random().toString(10),o={__uspapiCall:{command:e,parameter:t,callId:n}};r.uspapiCallbacks[n]=i,s.postMessage(o,"*")},this.currentWindow.addEventListener("message",function(e){var t="string"==typeof e.data?ze(e.data):e.data;if(t&&t.__uspapiReturn&&t.__uspapiReturn.callId&&t.__uspapiReturn.returnValue){var i=t.__uspapiReturn;r.uspapiCallbacks&&r.uspapiCallbacks[i.callId]&&(r.uspapiCallbacks[i.callId](i.returnValue,i.success),delete r.uspapiCallbacks[i.callId])}},!1)}this.currentWindow.__uspapi(e,t,i)},Ve.prototype.hasUserOptOut=function(e){return!(!e||!e.uspString||"1YNY"===e.uspString.toUpperCase()||"1YNN"===e.uspString.toUpperCase()||"1YN-"===e.uspString.toUpperCase()||"1-N-"===e.uspString.toUpperCase()||"1---"===e.uspString)},Ve);function Ve(e,t,i){void 0===i&&(i=function(e){}),this.uspapiCallbacks={},this.currentWindow=e,this.timeout=t.uspApiTimeout,this.logger=i}var Ye=(je.prototype.getReadyToRetrieveProvider=function(){return this.tcfv2ConsentProvider.hasCallerFunctionInFrame()?this.tcfv2ConsentProvider:this.tcfv1ConsentProvider.hasCallerFunctionInFrame()?this.tcfv1ConsentProvider:void 0!==this.tcfv2ConsentProvider.getCMPFrame()?this.tcfv2ConsentProvider:void 0!==this.tcfv1ConsentProvider.getCMPFrame()?this.tcfv1ConsentProvider:void 0},je.prototype.retrieveConsentForPassback=function(e){var t=this.getReadyToRetrieveProvider();void 0===t&&(this.logger("No compatible GDPR privacy provider found"),e(void 0)),t===this.tcfv1ConsentProvider?this.tcfv1ConsentProvider.retrieveConsentForPassback(e):t===this.tcfv2ConsentProvider&&this.tcfv2ConsentProvider.retrieveConsent(e)},je.prototype.retrieveConsent=function(e){var t=this.getReadyToRetrieveProvider();void 0===t&&(this.logger("No compatible GDPR privacy provider found"),e(void 0)),null==t||t.retrieveConsent(e)},je.prototype.readyToRetrieve=function(){return this.tcfv2ConsentProvider.readyToRetrieve()||this.tcfv1ConsentProvider.readyToRetrieve()},je);function je(e,t,i){void 0===i&&(i=function(e){}),this.tcfv1ConsentProvider=e,this.tcfv2ConsentProvider=t,this.logger=i}var Je=(Xe.prototype.getCMPFrame=function(){for(var e,t=this.currentWindow,i=0;i<10;++i){try{t.frames.__cmpLocator&&(e=t)}catch(e){}if(t===this.currentWindow.top)break;t=t.parent}return e},Xe.prototype.hasCallerFunctionInFrame=function(){return"function"==typeof this.currentWindow.__cmp},Xe.prototype.readyToRetrieve=function(){return this.hasCallerFunctionInFrame()||void 0!==this.getCMPFrame()},Xe.prototype.pingWithTimeout=function(n,e,t,i){function o(e,t){r.logger(t),clearTimeout(e),i()}var r=this;return window.setTimeout(function(){var i=window.setTimeout(function(){o(n,"Timeout: Unable to get ping return after "+e+"ms")},e);r.executeCommand("ping",null,function(e,t){clearTimeout(i),t?(r.logger("GDPR CMP ping returned"),!0!==e.cmpLoaded&&o(n,"GDPR ping returned cmpLoaded which is not true"),r.logger("GDPR ping returned cmpLoaded which is true")):o(n,"Error sending ping to GDPR CMP")})},t)},Xe.prototype.retrieveConsent=function(e){this.executeRetrieveConsent("getConsentData",null,e)},Xe.prototype.retrieveConsentForPassback=function(e){this.executeRetrieveConsent("getVendorConsents",[91],e)},Xe.prototype.executeRetrieveConsent=function(e,t,i){var n=this,o=!1,r=window.setTimeout(function(){o=!0,n.logger("Timeout: Unable to resolve GDPR consent after "+n.timeout+"ms"),i(void 0)},this.timeout),s=!1!==this.cmpAutoDetect?this.pingWithTimeout(r,this.pingTimeout,this.pingDelay,function(){o=!0,n.logger("Timeout: Unable to ping GDPR API after "+n.pingTimeout+"ms"),i(void 0)}):void 0;this.executeCommand(e,t,function(e,t){clearTimeout(s),o||(clearTimeout(r),t?(n.logger("GDPR consent retrieved"),n.processConsentData(e,i)):(n.logger("Error retrieving GDPR consent data from CMP"),i(void 0)))})},Xe.prototype.processConsentData=function(e,t){if(e){var i={};void 0!==e.consentData&&(i.consentData=e.consentData),void 0!==e.gdprApplies&&(i.gdprApplies=!!e.gdprApplies),t(i)}else this.logger("Unable to read GDPR consent data from CMP"),t(void 0)},Xe.prototype.executeCommand=function(e,t,i){var r=this;if(!this.hasCallerFunctionInFrame()){this.logger("No GDPR CMP defined on current frame");var s=this.getCMPFrame();this.currentWindow.__cmp=function(e,t,i){if(!s)return r.logger("GDPR CMP not found in any frame"),void i({msg:"GDPR CMP not found in any frame"},!1);var n=Math.random().toString(10),o={__cmpCall:{command:e,parameter:t,callId:n}};r.cmpCallbacks[n]=i,s.postMessage(o,"*")},this.currentWindow.addEventListener("message",function(e){var t="string"==typeof e.data?ze(e.data):e.data;if(t&&t.__cmpReturn&&t.__cmpReturn.callId&&t.__cmpReturn.returnValue){var i=t.__cmpReturn;r.cmpCallbacks&&r.cmpCallbacks[i.callId]&&(r.cmpCallbacks[i.callId](i.returnValue,i.success),delete r.cmpCallbacks[i.callId])}},!1)}this.currentWindow.__cmp(e,t,i)},Xe);function Xe(e,t,i){void 0===i&&(i=function(e){}),this.cmpCallbacks={},this.currentWindow=e,this.timeout=t.tcfTimeout,this.pingTimeout=t.tcfPingTimeout,this.pingDelay=t.tcfPingDelay,this.cmpAutoDetect=t.cmpAutoDetect,this.logger=i}var Ze=(Qe.prototype.getCMPFrame=function(){for(var e,t=this.currentWindow,i=0;i<10;++i){try{t.frames.__tcfapiLocator&&(e=t)}catch(e){}if(t===this.currentWindow.top)break;t=t.parent}return e},Qe.prototype.hasCallerFunctionInFrame=function(){return"function"==typeof this.currentWindow.__tcfapi},Qe.prototype.readyToRetrieve=function(){return this.hasCallerFunctionInFrame()||void 0!==this.getCMPFrame()},Qe.prototype.pingWithTimeout=function(i,e,t,n){function o(e,t){r.logger(t),clearTimeout(e),n()}var r=this;return window.setTimeout(function(){var t=window.setTimeout(function(){o(i,"Timeout: Unable to get TCFv2 ping return after "+e+"ms")},e);r.executeCommand("ping",2,function(e){clearTimeout(t),r.logger("TCFv2 CMP ping returned in ms"),"error"===e.cmpStatus?o(i,"Error status on ping to TCFv2 CMP"):!0!==e.cmpLoaded?o(i,"TCFv2 ping returned cmpLoaded = false"):r.logger("TCFv2 ping returned cmpLoaded = true")})},t)},Qe.prototype.retrieveConsent=function(i){var n=this,o=!1,r=window.setTimeout(function(){o=!0,n.logger("Timeout: Unable to resolve TCFv2 consent after "+n.timeout+"ms"),i(void 0)},this.timeout),s=!1!==this.cmpAutoDetect?this.pingWithTimeout(r,this.pingTimeout,this.pingDelay,function(){o=!0,n.logger("Timeout: Unable to ping TCFv2 API after "+n.pingTimeout+"ms"),i(void 0)}):void 0;this.executeCommand("getTCData",2,function(e,t){clearTimeout(s),o||(clearTimeout(r),t?(n.logger("TCFv2 consent retrieved in ms"),n.processResponseData(e,i)):(n.logger("Error retrieving TCFv2 consent data from CMP"),i(void 0)))},[91])},Qe.prototype.processResponseData=function(e,t){var i;if(e){var n={};void 0!==e.tcString&&(n.consentData=e.tcString),void 0!==e.gdprApplies&&(n.gdprApplies=!!e.gdprApplies),n.version=e.tcfPolicyVersion?e.tcfPolicyVersion:2,n.purposes=null===(i=null==e?void 0:e.purpose)||void 0===i?void 0:i.consents,t(n)}else this.logger("Unable to read GDPR consent data from CMP"),t(void 0)},Qe.prototype.executeCommand=function(e,t,i,n){var s=this;if(!this.hasCallerFunctionInFrame()){this.logger("No TCFv2 CMP defined on current frame");var a=this.getCMPFrame();this.currentWindow.__tcfapi=function(e,t,i,n){if(!a)return s.logger("TCFv2 CMP not found in any frame"),void i({msg:"TCFv2 CMP not found in any frame"},!1);var o=Math.random().toString(10),r={__tcfapiCall:{command:e,version:t,parameter:n,callId:o}};s.cmpCallbacks[o]=i,a.postMessage(r,"*")},this.currentWindow.addEventListener("message",function(e){var t="string"==typeof e.data?ze(e.data):e.data;if(t&&t.__tcfapiReturn&&t.__tcfapiReturn.callId&&t.__tcfapiReturn.returnValue){var i=t.__tcfapiReturn;s.cmpCallbacks&&s.cmpCallbacks[i.callId]&&"function"==typeof s.cmpCallbacks[i.callId]&&(s.cmpCallbacks[i.callId](i.returnValue,i.success),delete s.cmpCallbacks[i.callId])}},!1)}this.currentWindow.__tcfapi(e,t,i,n)},Qe);function Qe(e,t,i){void 0===i&&(i=function(e){}),this.cmpCallbacks={},this.currentWindow=e,this.timeout=t.tcfTimeout,this.pingTimeout=t.tcfPingTimeout,this.pingDelay=t.tcfPingDelay,this.cmpAutoDetect=t.cmpAutoDetect,this.logger=i}var $e=(et.prototype.checkTcfPurposeOne=function(e){return!e||!e.purposes||!0===e.purposes[1]},et.prototype.setCookie=function(e,t,i,n,o){void 0===o&&(o=!1);var r=n||document,s=r.location.hostname,a=new Date;a.setTime(a.getTime()+60*i*60*1e3);var d="expires="+a.toUTCString();if(!o)return this.setCookieString(e,t,d,void 0,r),s;for(var c=s.split("."),l=0;l<c.length;++l){var u=c.slice(c.length-l-1,c.length).join(".");this.setCookieString(e,t,d,u,r);var p=this.getCookie(e,n);if(p&&p===t)return u}return s},et.prototype.deleteCookie=function(e,t,i){void 0===i&&(i=!1),this.setCookie(e,"",0,t,i)},et.prototype.getCookie=function(e,t){if(this.cookiesEnabled)for(var i=0,n=(t||document).cookie.split(";");i<n.length;i++){var o=n[i],r=o.substr(0,o.indexOf("=")).replace(/^\s+|\s+$/g,""),s=o.substr(o.indexOf("=")+1);if(r===e)return decodeURIComponent(s)}},et.prototype.setCookieString=function(e,t,i,n,o){if(this.cookiesEnabled){var r=e+"="+encodeURIComponent(t)+";"+i+";";n&&""!==n&&(r+="domain=."+n+";"),o.cookie=r+"path=/"}},et);function et(e){this.cookiesEnabled=this.checkTcfPurposeOne(e)}var tt=(it.prototype.initializeServices=function(){var n=this;this.initializing=!0,this.retrievePrivacyConsent(function(e,t){var i={localStorageHelper:new me(n.topFrame,t),gdprConsent:t,ccpaConsentProvider:n.ccpaConsentProvider,ccpaConsent:e,cookieHelper:new $e(t)};n.services=i,n.initialized=!0,n.initializing=!1,n.postInitiliazeServicesCallbacks.forEach(function(e){e(i)})})},it.prototype.getServicesAsync=function(e){this.initialized?e(this.services):(this.postInitiliazeServicesCallbacks.push(e),this.initializing||this.initializeServices())},it.prototype.retrievePrivacyConsent=function(t){var e=this.tcfCompatibleConsentProvider.readyToRetrieve(),i=this.ccpaConsentProvider.readyToRetrieve();e||i||t(void 0,void 0);var n,o,r=[];e&&r.push(Ye),i&&r.push(Ge),e&&this.tcfCompatibleConsentProvider.retrieveConsent(function(e){r.splice(r.indexOf("TCF"),1),0===r.length?t(o,e):n=e}),i&&this.ccpaConsentProvider.retrieveConsent(function(e){r.splice(r.indexOf("CCPA"),1),0===r.length?t(e,n):o=e})},it);function it(e,t,i,n){this.initializing=!1,this.initialized=!1,this.postInitiliazeServicesCallbacks=[],this.topFrame=e||window;var o,r=(o=n,{uspApiTimeout:parseInt("50",10),tcfTimeout:parseInt("10000",10),tcfPingTimeout:Math.min(parseInt("10000",10),parseInt("50",10)),tcfPingDelay:Math.min(parseInt("10000",10),parseInt("1000",10)),cmpAutoDetect:null==o?void 0:o.cmpAutoDetect});this.ccpaConsentProvider=t||new Ge(window,r,M.Warning);var s=new Je(window,r,M.Warning),a=new Ze(window,r,M.Warning);this.tcfCompatibleConsentProvider=i||new Ye(s,a,M.Warning),this.initializeServices()}var nt,ot=(e(rt,nt=h),rt.prototype.getMetricBuilder=function(){return this.metricBuilder},rt.prototype.eval=function(e){this.evalWithTimeout(e,void 0)},rt.prototype.evalWithTimeout=function(t,i){var n=this;(this.serviceProvider||new tt).getServicesAsync(function(e){n.metricsManager||(n.metricsManager=new j(e.localStorageHelper)),n.metricBuilder||(n.metricBuilder=new k(n.metricsManager)),n.innerEval(t,n.metricBuilder,e.gdprConsent,e.ccpaConsent,i)})},rt.prototype.innerEval=function(n,o,r,s,e){var a=this,d=te(),t=rt.getCriteoAdapterBidRequest(),i=rt.getRequestAuctionStart(t),c=e||le(t&&t.timeout),l=new se(o,i,c),u=new Q(this.slots,n.context,this.urlBuilder,this.profileId,this.integrationMode,this.networkId,this.adapterVersion,{ccpaIabConsent:s,gdprConsent:r},void 0,this.viewportComputer,c,d,n.context.userIds,Math.round(new Date/1e3));if(!u.isValid()||"undefined"==typeof JSON)return M.Debug("Request ignored because it doesnt contain any slot"),void this.callbackError(void 0,void 0);var p=u.getRequest(),h=JSON.stringify(p),v=u.getUrl(),g=new ke(v,h,"application/x-www-form-urlencoded");l.sendRequest(v),g.send(function(e){try{l.requestReceived();var t=F(e)||{},i=ee(t);void 0!==a.callbackSuccess&&a.callbackSuccess(JSON.stringify(t),i),l.finish(),!0===t.user_sync&&Ne.execUserSync(n.context.remoteLogging,r,s,t),o.getMetricsManager().sendEvents(o,d,!0)}catch(e){a.reportAsyncRequestException(n,"onSuccess",e)}n.context.remoteLogging.sendErrorReport(a.urlBuilder,d),a.metricBuilder=void 0},function(e,t){try{l.requestReceived(),void 0!==a.callbackError&&a.callbackError(e,t),l.finish(),o.getMetricsManager().sendEvents(o,d,!0)}catch(e){a.reportAsyncRequestException(n,"onError",e)}n.context.remoteLogging.sendErrorReport(a.urlBuilder,d),a.metricBuilder=void 0},function(){try{l.requestReceived(!0),void 0!==a.callbackTimeout&&a.callbackTimeout(),l.finish(),o.getMetricsManager().sendEvents(o,d,!0)}catch(e){a.reportAsyncRequestException(n,"onTimeout",e)}n.context.remoteLogging.sendErrorReport(a.urlBuilder,d),a.metricBuilder=void 0},this.timeout)},rt.prototype.reportAsyncRequestException=function(e,t,i){var n=i.stack?i.stack:i.toString();e.context.remoteLogging.log("Exception","Exception caught in AsyncRequest "+t+" callback:\n"+n),M.Error("Error "+t+":\n\t"+n)},rt.getCriteoAdapterBidRequest=function(){try{return window.pbjs._bidsRequested.find(function(e){return"criteo"===e.bidderCode})}catch(e){return}},rt.getRequestAuctionStart=function(e){return e&&e.auctionStart},rt.NAME="directbidding",rt);function rt(e,t,i,n,o,r,s,a,d,c,l,u,p){var h=nt.call(this,rt.NAME)||this;return h.profileId=e,h.urlBuilder=t,h.slots=i,h.callbackSuccess=n,h.callbackError=o,h.callbackTimeout=r,h.serviceProvider=s,h.timeout=d,h.networkId=c,h.integrationMode=l,h.adapterVersion=u,h.viewportComputer=p,h.metricsManager=a,h.metricsManager&&(h.metricBuilder=new k(h.metricsManager)),h}var st,at=(e(dt,st=h),dt.prototype.eval=function(e){var t=this;if(this.cache.silentModeEnabled())return M.Debug("Request ignored because the global silent mode is enabled"),this.metricsManager.incSilentModeRequestCount(),void this.callbackSuccess("",void 0);setTimeout(function(){return t.onTimeout()},this.timeout||3e3),this.directBiddingEvent.evalWithTimeout(e,this.timeout)},dt.prototype.onSuccess=function(e,t){if(this.hasResponded=!0,void 0!==t){var i=F(e);this.cache.handleResponse(this.slots,i,t,this.hasTimeouted)}this.hasTimeouted||this.callbackSuccess(e,t),this.cache.clearExpiredItems()},dt.prototype.onError=function(e,t){this.hasResponded=!0,this.hasTimeouted||this.callbackError(e,t),this.cache.clearExpiredItems()},dt.prototype.onHttpTimeout=function(){this.hasResponded=!0,this.hasTimeouted||this.callbackTimeout(),this.cache.clearExpiredItems()},dt.prototype.onTimeout=function(){var e;if(!this.hasResponded){this.hasTimeouted=!0;var t=this.cache.getCachedBids(this.slots),i=Object.keys(t),n=i.map(function(e){return t[e]});0===Object.keys(t).length?this.callbackTimeout():(M.Debug("Cached bids returned because of timeout: ['"+n.map(function(e){return e.impid}).join("', '")+"']"),null===(e=this.getMetricBuilder())||void 0===e||e.withSlotIdsMatchedByCache(i),this.callbackSuccess(JSON.stringify({slots:n}),void 0))}},dt.prototype.getMetricBuilder=function(){return this.directBiddingEvent.getMetricBuilder()},dt.prototype.getBidCache=function(){return this.cache},dt.NAME="directbidding",dt);function dt(e,t,i,n,o,r,s,a,d,c,l,u,p,h){var v=st.call(this,dt.NAME)||this,g=Math.max(10*(c||3e3),3e3);return v.cache=a,v.directBiddingEvent=new ot(e,t,v.cache.filterNoBidSlots(i),function(e,t){return v.onSuccess(e,t)},function(e,t){return v.onError(e,t)},function(){return v.onHttpTimeout()},d,s,g,l,u,p,h),v.slots=i,v.callbackSuccess=n,v.callbackError=o,v.callbackTimeout=r,v.timeout=c,v.hasTimeouted=!1,v.hasResponded=!1,v.metricsManager=s,v}var ct={prebid:"criteo_fast_bid",index:"criteo_fast_bid_index"};function lt(e){function t(){try{return i.apply(this,arguments)}catch(e){M.Error("Exception caught: "+e.toString())}}var i=e;for(var n in t.prototype=i.prototype,i)i.hasOwnProperty(n)&&(t[n]=i[n]);return t}var ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var pt,ht,vt,gt=(function(e,t){var i;i=function(){function d(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,t=void 0,o=void 0,s=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(h):y())};var e="undefined"!=typeof window?window:void 0,r=e||{},a=r.MutationObserver||r.WebKitMutationObserver,c="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function u(){var e=setTimeout;return function(){return e(h,1)}}var p=new Array(1e3);function h(){for(var e=0;e<n;e+=2){(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0}n=0}var v,g,f,m,y=void 0;function C(e,t){var i=this,n=new this.constructor(b);void 0===n[w]&&F(n);var o=i._state;if(o){var r=arguments[o-1];s(function(){return k(o,n,r,i._result)})}else D(i,n,e,t);return n}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return R(t,e),t}y=c?function(){return process.nextTick(h)}:a?(g=0,f=new a(h),m=document.createTextNode(""),f.observe(m,{characterData:!0}),function(){m.data=g=++g%2}):l?((v=new MessageChannel).port1.onmessage=h,function(){return v.port2.postMessage(0)}):(void 0===e?function(){try{var e=Function("return this")().require("vertx");return void 0!==(t=e.runOnLoop||e.runOnContext)?function(){t(h)}:u()}catch(e){return u()}}:u)();var w=Math.random().toString(36).substring(2);function b(){}var I=void 0,_=1,S=2;function T(e,n,o){s(function(t){var i=!1,e=function(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}(o,n,function(e){i||(i=!0,(n!==e?R:P)(t,e))},function(e){i||(i=!0,x(t,e))},t._label);!i&&e&&(i=!0,x(t,e))},e)}function A(e,t,i){var n,o;t.constructor===e.constructor&&i===C&&t.constructor.resolve===E?(n=e,(o=t)._state===_?P(n,o._result):o._state===S?x(n,o._result):D(o,void 0,function(e){return R(n,e)},function(e){return x(n,e)})):void 0===i?P(e,t):d(i)?T(e,t,i):P(e,t)}function R(t,e){if(t===e)x(t,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(n=e),null===n||"object"!=o&&"function"!=o)P(t,e);else{var i=void 0;try{i=e.then}catch(e){return void x(t,e)}A(t,e,i)}var n,o}function M(e){e._onerror&&e._onerror(e._result),O(e)}function P(e,t){e._state===I&&(e._result=t,e._state=_,0!==e._subscribers.length&&s(O,e))}function x(e,t){e._state===I&&(e._state=S,e._result=t,s(M,e))}function D(e,t,i,n){var o=e._subscribers,r=o.length;e._onerror=null,o[r]=t,o[r+_]=i,o[r+S]=n,0===r&&e._state&&s(O,e)}function O(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,o=void 0,r=e._result,s=0;s<t.length;s+=3)n=t[s],o=t[s+i],n?k(i,n,o,r):o(r);e._subscribers.length=0}}function k(e,t,i,n){var o=d(i),r=void 0,s=void 0,a=!0;if(o){try{r=i(n)}catch(e){a=!1,s=e}if(t===r)return void x(t,new TypeError("A promises callback cannot return that same promise."))}else r=n;t._state!==I||(o&&a?R(t,r):!1===a?x(t,s):e===_?P(t,r):e===S&&x(t,r))}var B=0;function F(e){e[w]=B++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=(N.prototype._enumerate=function(e){for(var t=0;this._state===I&&t<e.length;t++)this._eachEntry(e[t],t)},N.prototype._eachEntry=function(t,e){var i=this._instanceConstructor,n=i.resolve;if(n===E){var o=void 0,r=void 0,s=!1;try{o=t.then}catch(e){s=!0,r=e}if(o===C&&t._state!==I)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(i===L){var a=new i(b);s?x(a,r):A(a,t,o),this._willSettleAt(a,e)}else this._willSettleAt(new i(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)},N.prototype._settledAt=function(e,t,i){var n=this.promise;n._state===I&&(this._remaining--,e===S?x(n,i):this._result[t]=i),0===this._remaining&&P(n,this._result)},N.prototype._willSettleAt=function(e,t){var i=this;D(e,void 0,function(e){return i._settledAt(_,t,e)},function(e){return i._settledAt(S,t,e)})},N);function N(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[w]||F(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&P(this.promise,this._result))):x(this.promise,new Error("Array Methods must be provided an Array"))}var L=(H.prototype.catch=function(e){return this.then(null,e)},H.prototype.finally=function(t){var i=this.constructor;return d(t)?this.then(function(e){return i.resolve(t()).then(function(){return e})},function(e){return i.resolve(t()).then(function(){throw e})}):this.then(t,t)},H);function H(e){this[w]=B++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof H?function(t,e){try{e(function(e){R(t,e)},function(e){x(t,e)})}catch(e){x(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return L.prototype.then=C,L.all=function(e){return new U(this,e).promise},L.race=function(o){var r=this;return i(o)?new r(function(e,t){for(var i=o.length,n=0;n<i;n++)r.resolve(o[n]).then(e,t)}):new r(function(e,t){return t(new TypeError("You must pass an array to race."))})},L.resolve=E,L.reject=function(e){var t=new this(b);return x(t,e),t},L._setScheduler=function(e){o=e},L._setAsap=function(e){s=e},L._asap=s,L.polyfill=function(){var e=void 0;if(void 0!==ut)e=ut;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=L},L.Promise=L},e.exports=i()}(pt={exports:{}},pt.exports),pt.exports).polyfill,ft=(mt.LoadPolyfills=function(){mt.DefineIsArray(),mt.DefineIndexOf(),mt.DefineFilter(),mt.DefinePromise()},mt.DefinePromise=function(){window.Promise||gt()},mt.DefineIsArray=function(){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)})},mt.DefineIndexOf=function(){Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){if(void 0===t&&(t=0),void 0===this)throw new TypeError("'this' is null or not defined");var i=this.length;if(0===i)return-1;if(i<=t)return-1;for(var n=Math.max(0<=t?t:i-Math.abs(t),0);n<i;){if(n in this&&this[n]===e)return n;n++}return-1})},mt.DefineFilter=function(){Array.prototype.filter||(Array.prototype.filter=function(e){if(void 0===this||void 0===this)throw new TypeError;var t=this.length;if("function"!=typeof e)throw new TypeError;for(var i=[],n=2<=arguments.length?arguments[1]:void 0,o=0;o<t;o++)if(o in this){var r=this[o];e.call(n,r,o,this)&&i.push(r)}return i})},mt);function mt(){}function yt(t,i){try{return decodeURIComponent(t)}catch(e){return void 0!==i?i:t}}(vt=ht=ht||{})[vt.None=0]="None",vt[vt.Cookie=1]="Cookie",vt[vt.LocalStorage=2]="LocalStorage";var Ct=(Et.prototype.synchronizeCriteoUid=function(e,t){var i=this;if(this.gdprConsent=e,this.topWin.addEventListener)if("complete"===this.topDoc.readyState)this.appendGumIframeIfDoesNotExist(t);else{var n=function(){i.topDoc.removeEventListener("DOMContentLoaded",n),i.topWin.removeEventListener("load",n),i.appendGumIframeIfDoesNotExist(t)};this.topWin.addEventListener("load",n,!1),this.topDoc.addEventListener("DOMContentLoaded",n,!1)}},Et.prototype.appendGumIframeIfDoesNotExist=function(r){var s=this,e=this.createGumIframe();this.topDoc.getElementById(Et.SYNCFRAME_ID)||(this.topWin.addEventListener("message",function(e){var t=e.data;if(t&&e.origin==Et.SYNCFRAME_ORIGIN)if(e.stopImmediatePropagation(),t.optout)s.setClientSideOptOut(),s.deleteClientSideUid(),s.deleteClientSideSecureId(),s.deleteBundle();else{if(t.uid&&s.setClientSideUid(t.uid),t.callbacks)for(var i=0,n="string"==typeof t.callbacks?[t.callbacks]:t.callbacks;i<n.length;i++){var o=n[i];(new Image).src=o}else t.bundle&&(s.setBundle(t.bundle),r&&r(t.enableEsp?t.bundle:""));t.removeSid?s.deleteClientSideSecureId():t.sid&&s.setClientSideSecureId(t.sid)}},!0),this.topDoc.body.appendChild(e))},Et.prototype.getClientSideUid=function(){return this.getFromAllStorages(Et.GUID_COOKIE_NAME)},Et.prototype.setClientSideUid=function(e){this.writeOnAllStorages(Et.GUID_COOKIE_NAME,e,Et.GUID_RETENTION_TIME_HOUR)},Et.prototype.deleteClientSideUid=function(){this.deleteFromAllStorage(Et.GUID_COOKIE_NAME)},Et.prototype.getBundle=function(){return this.getFromAllStorages(Et.BUNDLE_COOKIE_NAME)},Et.prototype.setBundle=function(e){this.writeOnAllStorages(Et.BUNDLE_COOKIE_NAME,e,Et.GUID_RETENTION_TIME_HOUR)},Et.prototype.deleteBundle=function(){this.deleteFromAllStorage(Et.BUNDLE_COOKIE_NAME)},Et.prototype.getClientSideOptOut=function(){var e=this.getFromAllStorages(Et.OPTOUT_COOKIE_NAME);return{value:"1"===e.value,origin:e.origin}},Et.prototype.setClientSideOptOut=function(){this.writeOnAllStorages(Et.OPTOUT_COOKIE_NAME,"1",Et.OPTOUT_RETENTION_TIME_HOUR)},Et.prototype.getClientSideSecureId=function(){return this.getFromAllStorages(Et.SECURE_ID_COOKIE_NAME)},Et.prototype.setClientSideSecureId=function(e){this.writeOnAllStorages(Et.SECURE_ID_COOKIE_NAME,e,Et.GUID_RETENTION_TIME_HOUR)},Et.prototype.deleteClientSideSecureId=function(){this.deleteFromAllStorage(Et.SECURE_ID_COOKIE_NAME)},Et.prototype.getClientSideLocalWebId=function(){return this.getFromAllStorages(Et.LOCAL_WEB_ID_COOKIE_NAME)},Et.prototype.getIfa=function(){return this.getFromAllStorages(Et.IFA_COOKIE_NAME)},Et.prototype.checkCookiesAreWriteable=function(){var e="cto_writeable";this.cookieHelper.setCookie(e,"1",1,this.topDoc,!0);var t="1"===this.cookieHelper.getCookie(e,this.topDoc);return this.cookieHelper.deleteCookie(e,this.topDoc,!0),t},Et.prototype.createGumIframe=function(){var e=this.topDoc.createElement("iframe");return e.src=this.buildSyncframeSrc(),e.id=Et.SYNCFRAME_ID,e.style.display="none",e},Et.prototype.writeOnAllStorages=function(e,t,i){this.localStorageHelper.setItem(e,t),this.cookieHelper.setCookie(e,t,i,this.topDoc,!0)},Et.prototype.getFromAllStorages=function(e){var t=this.cookieHelper.getCookie(e,this.topDoc),i=this.localStorageHelper.getItem(e)||void 0;return{value:t||i,origin:(t&&ht.Cookie)|(i&&ht.LocalStorage)}},Et.prototype.deleteFromAllStorage=function(e){this.cookieHelper.deleteCookie(e,this.topDoc,!0),this.localStorageHelper.removeItem(e)},Et.prototype.getTld=function(){var e=this.cookieHelper.setCookie(Et.TLD_TEST_COOKIE_NAME,"test",1,this.topDoc,!0);return this.cookieHelper.deleteCookie(Et.TLD_TEST_COOKIE_NAME,this.topDoc,!0),e},Et.prototype.buildSyncframeSrc=function(){var e,t,i=this.getClientSideUid(),n=this.getClientSideOptOut(),o=this.getClientSideSecureId(),r=this.getClientSideLocalWebId(),s=this.getBundle(),a=this.getIfa(),d=this.getTld(),c=encodeURIComponent((e=this.topUrl,(t=document.createElement("a")).href=e,{protocol:t.protocol,host:t.host,hostname:t.hostname,pathname:"/"===t.pathname[0]?t.pathname.slice(1):t.pathname,search:t.search,href:t.href}).hostname),l=this.canWriteCookies,u=this.localStorageHelper.localStorageEnabled,p=[];p.push("topUrl="+c),this.gdprConsent&&(void 0!==this.gdprConsent.gdprApplies&&p.push("gdpr="+(this.gdprConsent.gdprApplies?1:0)),p.push("gdpr_consent="+(this.gdprConsent.consentData?this.gdprConsent.consentData:""))),this.isDebug&&p.push("debug=1");var h=JSON.stringify({optout:n,uid:i,sid:o,origin:"publishertag",version:106,lwid:r,tld:d,bundle:s,topUrl:c,cw:l,ifa:a,lsw:u});return Et.SYNCFRAME_ENDPOINT+"?"+p.join("&")+"#"+h},Et.GUID_COOKIE_NAME="cto_idcpy",Et.GUID_RETENTION_TIME_HOUR=9360,Et.SECURE_ID_COOKIE_NAME="cto_sid",Et.LOCAL_WEB_ID_COOKIE_NAME="cto_lwid",Et.BUNDLE_COOKIE_NAME="cto_bundle",Et.OPTOUT_COOKIE_NAME="cto_optout",Et.IFA_COOKIE_NAME="id_controller_ifa",Et.OPTOUT_RETENTION_TIME_HOUR=43200,Et.TLD_TEST_COOKIE_NAME="cto_pub_test_tld",Et.SYNCFRAME_ID="criteo-syncframe",Et.SYNCFRAME_ORIGIN="https://gum.criteo.com",Et.SYNCFRAME_ENDPOINT="https://gum.criteo.com/syncframe",Et);function Et(e,t,i,n,o){this.isDebug=n,this.topWin=i,this.topDoc=i.document,this.cookieHelper=e,this.localStorageHelper=t,this.canWriteCookies=this.checkCookiesAreWriteable(),this.topUrl=o}var wt=function(e,t){this.errorType=e,this.messages=t},bt=function(e,t,i){this.environment=e,this.errors=t,this.requestId=i},It=(_t.prototype.withMessage=function(e,t){return e in this.messages||(this.messages[e]=new Array),this.messages[e].push(t),this},_t.prototype.withRequestId=function(e){return this.requestId=e,this},_t.prototype.build=function(){var e=Array();for(var t in this.messages)null!=t&&e.push(new wt(t,this.messages[t]));return new bt(this.environment,e,this.requestId)},_t);function _t(e){this.messages={},this.environment=e}var St,Tt,At=(Rt.prototype.reportPending=function(){return this.shouldSend},Rt.prototype.sendErrorReport=function(e,t){if(this.shouldSend){void 0!==t&&this.builder.withRequestId(t);var i=this.builder.build(),n=e.buildErrorUrl();n+=this.debug?"?debug=1":"";var o=JSON.stringify(i);navigator.sendBeacon&&navigator.sendBeacon(n,o),this.shouldSend=!1,this.builder=new It(Rt.environment)}},Rt.prototype.log=function(e,t){this.shouldSend=!0,this.builder.withMessage(e,t)},Rt.environment="PublisherTag Version "+W,Rt);function Rt(e){void 0===e&&(e=!1),this.builder=new It(Rt.environment),this.shouldSend=!1,this.debug=e}function Mt(e){window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],window.googletag.cmd.push(e)}(Tt=St=St||{})[Tt.InFriendlyIframe=1]="InFriendlyIframe",Tt[Tt.InUnfriendlyIframe=2]="InUnfriendlyIframe",Tt[Tt.DirectIntegration=3]="DirectIntegration";var Pt=(xt.prototype.getUserContextualData=function(){var e,t,i,n,o,r,s,a,d,c,l,u,p,h;return{data:{contentLanguage:this.getContentLanguage(),navigatorLanguage:null===(t=null===(e=this.window)||void 0===e?void 0:e.navigator)||void 0===t?void 0:t.language,orientation:this.getOrientation(),windowInnerWidth:null===(i=this.window)||void 0===i?void 0:i.innerWidth,windowInnerHeight:null===(n=this.window)||void 0===n?void 0:n.innerHeight,pageWidth:null===(s=null===(r=null===(o=this.window)||void 0===o?void 0:o.document)||void 0===r?void 0:r.documentElement)||void 0===s?void 0:s.scrollWidth,pageHeight:null===(c=null===(d=null===(a=this.window)||void 0===a?void 0:a.document)||void 0===d?void 0:d.documentElement)||void 0===c?void 0:c.scrollHeight,sessionDuration:oe.TimeSincePageLoad()},device:{w:null===(u=null===(l=this.window)||void 0===l?void 0:l.screen)||void 0===u?void 0:u.width,h:null===(h=null===(p=this.window)||void 0===p?void 0:p.screen)||void 0===h?void 0:h.height}}},xt.prototype.getOrientation=function(){var e,t,i,n,o,r;return((null===(t=null===(e=this.window)||void 0===e?void 0:e.screen)||void 0===t?void 0:t.orientation)||{}).type||(null===(n=null===(i=this.window)||void 0===i?void 0:i.screen)||void 0===n?void 0:n.mozOrientation)||(null===(r=null===(o=this.window)||void 0===o?void 0:o.screen)||void 0===r?void 0:r.msOrientation)},xt.prototype.getContentLanguage=function(){var e,t,i,n,o,r=null===(i=null===(t=null===(e=this.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.documentElement)||void 0===i?void 0:i.lang;if(!r&&"function"==typeof(null===(o=null===(n=this.window)||void 0===n?void 0:n.document)||void 0===o?void 0:o.querySelector)){var s=this.window.document.querySelector('meta[http-equiv="Content-Language"]');r=null==s?void 0:s.content}return r},xt);function xt(e){this.window=e}var Dt,Ot=(e(kt,Dt=G),kt.prototype.sendSetEspPromiseTime=function(){this.sendEvents({eventId:"SetEspPromise",elapsed:oe.TimeSincePageLoad()})},kt.prototype.sendReturnEspPromiseToGptTime=function(){this.sendEvents({eventId:"ReturnEspPromiseToGpt",elapsed:oe.TimeSincePageLoad()})},kt.prototype.sendResolveEspPromiseTime=function(){this.sendEvents({eventId:"ResolveEspPromise",elapsed:oe.TimeSincePageLoad()})},kt.prototype.sendEvents=function(e){var t={requestId:this.context.getClientSessionId(),events:[e]};this.context.isEligibleForCsmEvents()&&this.sendEventsToBeacon(t,this.urlBuilder.buildCsmEventsUrl())},kt);function kt(e){var t=Dt.call(this)||this;return t.context=e,t}var Bt=(Ft.prototype.getContextFlags=function(){var e="";return e+=this.debugMode?"&debug=1":"",e+=this.noLog?"&nolog=1":""},Ft.prototype.isEligibleForCsmEvents=function(){return this.sessionRandomId%100==0},Ft.prototype.getClientSessionId=function(){return this.clientSessionId},Ft.prototype.getMetricsManager=function(){return this.contextMetricsManager},Ft.prototype.getDisplayContext=function(e){return he.inIframe()?e.err?St.InUnfriendlyIframe:St.InFriendlyIframe:St.DirectIntegration},Ft.prototype.getQueryStringParams=function(e){var t={},i=e.split("?");if(1<i.length)for(var n=0,o=i[1].split("&");n<o.length;n++){var r=o[n].split("=");t[yt(r[0])]=yt(r[1])}return t},Ft.prototype.synchronizeCriteoUid=function(e,t,i){var n,o=this,r=(null===(n=this.cookieSynchronizerFactory)||void 0===n?void 0:n.call(this))||new Ct(t,e,this.highestAccessibleWindowStruct.topFrame,this.debugMode,this.highestAccessibleUrl);this.ctoIdOnPublisherDomain=r.getClientSideUid().value,this.isOptOut=r.getClientSideOptOut().value,this.secureId=r.getClientSideSecureId().value,this.bundle=r.getBundle().value;var s,a,d=new Promise(function(t,e){r.synchronizeCriteoUid(i,function(e){M.Debug("Resolving GPT ESP Promise"),o.contextMetricsManager.sendResolveEspPromiseTime(),t(e)})});window.googletag&&(s=this.contextMetricsManager,a=d,Mt(function(){var e;window.googletag.encryptedSignalSource=null!==(e=window.googletag.encryptedSignalSource)&&void 0!==e?e:{},M.Debug("Promise set for GPT ESP"),window.googletag.encryptedSignalSource.criteo=function(){return M.Debug("Returning Promise to GPT"),s.sendReturnEspPromiseToGptTime(),a},s.sendSetEspPromiseTime()}))},Ft.prototype.getIdfs=function(){return["",this.secureId].join(":")},Ft.prototype.setIdfs=function(e){var t=e.split(":");t[1]&&(this.secureId=t[1])},Ft.prototype.computeShouldIgnoreSilentMode=function(){return Math.floor(100*Math.random())<5},Ft.prototype.setSilentModeIgnored=function(){this.silentModeIgnored=!0},Ft.prototype.setPublisherExt=function(e){this.publisherExt=e},Ft.prototype.getPublisherExt=function(){return this.publisherExt},Ft.prototype.setUserExt=function(e){this.userExt=e},Ft.prototype.getUserExtWithContextualData=function(){this.userExt=this.userExt||{};var e=this.userContextualDataManager.getUserContextualData();return this.userExt.data=_(_({},this.userExt.data),null==e?void 0:e.data),this.userExt.device=_(_({},this.userExt.device),null==e?void 0:e.device),this.userExt},Ft);function Ft(e,t,i,n,o,r,s,a){var d=this;void 0===s&&(s=(new Date).getUTCMilliseconds()),void 0===a&&(a=te()),this.cloneByImpressionId={},this.sessionRandomId=s,this.clientSessionId=a,this.contextMetricsManager=new Ot(this),this.charset=e.charset||e.characterSet||"",this.highestAccessibleWindowStruct=he.getHighestAccessibleWindow(t),this.displayContext=this.getDisplayContext(this.highestAccessibleWindowStruct),this.highestAccessibleUrl=he.getHighestAccessibleUrl(this.highestAccessibleWindowStruct),this.cookieSynchronizerFactory=i;var c,l=this.getQueryStringParams(this.highestAccessibleUrl);this.debugMode="1"===l.pbt_debug||!1,this.noLog="1"===l.pbt_nolog||!1,this.shouldIgnoreSilentMode=this.computeShouldIgnoreSilentMode(),this.silentModeIgnored=!1,this.remoteLogging=new At(this.debugMode),this.debugMode&&(c=u.Debug,M.LOGLEVEL=c),this.location=t.location,this.dising=!1,this.ct0=void 0,this.wpdt0=void 0,this.isAdBlocked=void 0,this.rtaVarNames=[],this.serviceProvider=n||new tt(this.highestAccessibleWindowStruct.topFrame,void 0,void 0,o),this.serviceProvider.getServicesAsync(function(e){var t;(null===(t=e.ccpaConsentProvider)||void 0===t?void 0:t.hasUserOptOut(e.ccpaConsent))||d.synchronizeCriteoUid(e.localStorageHelper,e.cookieHelper,e.gdprConsent)}),this.userContextualDataManager=r||new Pt(t)}var Ut=function(){this.bids={},this.lineItemRanges=[],this.impIds=[]};var Nt,Lt,Ht,qt=(Wt.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=0,n=e;i<n.length;i++){var o=n[i];this.events.push(o)}this.evalEvents()},Wt.prototype.evalEvents=function(){for(var e=0;e<this.events.length;){var t=this.events[e];if("conditionalEvent"!==t.name||t.canEval()){var i=this.events.splice(e,1);try{i[0].eval(this)}catch(e){M.Error("An exception occurred processing an event: "+e.toString())}}else e++}},Wt.VERSION=W,Wt);function Wt(e){var t;void 0===e&&(e=null===(t=window.Criteo_prebid_106||window.Criteo)||void 0===t?void 0:t.config),this.standaloneBidder=new Ut,this.events=[],this.context=new Bt(document,window,void 0,void 0,e),M.Debug("Publisher Tag loaded")}Nt=function e(t){for(var i in t)if(i in t){var n=t[i];"function"==typeof n?t[i]=lt(n):"object"==typeof n&&(t[i]=e(n))}return t}({PubTag:{Adapters:{Prebid:We},DirectBidding:{DirectBiddingEvent:at,DirectBiddingSlot:ie,DirectBiddingUrlBuilder:K,Size:de}},events:window.Criteo?window.Criteo.events:[],passbackEvents:window.Criteo?window.Criteo.passbackEvents:[],usePrebidEvents:!window.Criteo||window.Criteo.usePrebidEvents}),window.criteo_pubtag&&"serviceProvider"in window.criteo_pubtag.context||(ft.LoadPolyfills(),window.criteo_pubtag=new qt,window.criteo_pubtag_prebid_106=window.criteo_pubtag),window.Criteo=Nt,window.Criteo_prebid_106=window.Criteo,M.Debug("Publisher Tag initialized with window.criteo_pubtag|criteo_pubtag_prebid_106, window.Criteo|Criteo_prebid_106"),!1!==window.Criteo.usePrebidEvents&&(window.Criteo.events=(Lt=window.Criteo.events,Ht={push:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(void 0!==e)for(var i=0,n=e;i<n.length;i++){var o=n[i];"function"==typeof o&<(o)()}}},Lt&&Array.isArray(Lt)&&Ht.push.apply(Ht,Lt),Ht)),window.criteo_pubtag.context.serviceProvider.getServicesAsync(function(e){var t,i,n;t=e.localStorageHelper,n=ct[i="prebid"],null===t.getItem(n,864e5)&&new ke("https://static.criteo.net/js/ld/publishertag."+i+".js",void 0,void 0,!1).send(function(e){t.setItem(n,e,864e5)},function(e,t){M.Error("Could not update FastBid"+(t?" ("+t+")":""))})})}();</script><style type="text/css">.mui-textfield.mui-textfield--float-label > label {-webkit-transition:all .15s ease-out;-moz-transition:all .15s ease-out;-o-transition:all .15s ease-out;transition:all .15s ease-out;}</style><style type="text/css">@keyframes mui-btn-inserted{from{transform:none;}to{transform:none;}}.mui-btn{animation-duration:0.0001s;animation-name:mui-btn-inserted;}@keyframes mui-dropdown-inserted{from{transform:none;}to{transform:none;}}[data-mui-toggle="dropdown"]{animation-duration:0.0001s;animation-name:mui-dropdown-inserted;}@keyframes mui-btn-inserted,mui-dropdown-inserted{from{transform:none;}to{transform:none;}}.mui-btn[data-mui-toggle="dropdown"]{animation-duration:0.0001s;animation-name:mui-btn-inserted,mui-dropdown-inserted;}@keyframes mui-tab-inserted{from{transform:none;}to{transform:none;}}[data-mui-toggle="tab"]{animation-duration:0.0001s;animation-name:mui-tab-inserted;}@keyframes mui-textfield-inserted{from{transform:none;}to{transform:none;}}.mui-textfield > input{animation-duration:0.0001s;animation-name:mui-textfield-inserted;}@keyframes mui-textfield-inserted{from{transform:none;}to{transform:none;}}.mui-textfield > textarea{animation-duration:0.0001s;animation-name:mui-textfield-inserted;}@keyframes mui-select-inserted{from{transform:none;}to{transform:none;}}.mui-select > select{animation-duration:0.0001s;animation-name:mui-select-inserted;}@keyframes mui-node-inserted{from{transform:none;}to{transform:none;}}.mui-select > select ~ .mui-event-trigger{animation-duration:0.0001s;animation-name:mui-node-inserted;}@keyframes mui-node-disabled{from{transform:none;}to{transform:none;}}.mui-select > select:disabled ~ .mui-event-trigger{animation-duration:0.0001s;animation-name:mui-node-disabled;}</style> <title>Beautiful Soup Tutorial - Tutorialspoint</title> <meta content="Beautiful Soup Tutorial - In this tutorial, we will show you, how to perform web scraping in Python using Beautiful Soup 4 for getting data out of HTML, XML and other markup languages. I" name="description"/> <meta content="C, C++, Python, Java, HTML, CSS, JavaScript, SQL, PHP, jQuery, XML, DOM, Bootstrap, Tutorials, Articles, Programming, training, learning, quiz, preferences, examples, code" name="keywords"/> <link href="https://www.tutorialspoint.com/beautiful_soup/index.htm" rel="canonical"/> <link href="https://www.tutorialspoint.com/favicon.ico" rel="shortcut icon" type="image/x-icon"/> <meta content="width=device-width,initial-scale=1.0,user-scalable=yes" name="viewport"/> <link href="./Beautiful Soup Tutorial - Tutorialspoint_files/style-min-v1.css" rel="stylesheet"/> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/analytics.js.download" type="text/javascript"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/js" type="text/javascript"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/async-ads.js.download"></script><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/script-min-v1.js.download"></script><link href="./Beautiful Soup Tutorial - Tutorialspoint_files/prettify.css" rel="stylesheet" type="text/css"/> <script> function printPage() { window.print(); } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } </script> <script data-cfasync="false" id="adp1" type="text/javascript">(function(w, d) { var s = d.createElement('script'); s.src = '//cdn.adpushup.com/40046/adpushup.js'; s.type = 'text/javascript'; s.async = true; (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); })(window, document);</script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/adpushup.js.download" type="text/javascript"></script> <script data-cfasync="false" id="adp2" type="text/javascript">(function(w, d) {var cval = readCookie('subscription_purchased');if(cval == '1'){ return; } var s = d.createElement('script'); s.src = '//delivery.adrecover.com/18107/adRecover.js'; s.type = 'text/javascript'; s.async = true; (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); })(window, document);</script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/adRecover.js.download" type="text/javascript"></script> <style> .butnn-save a{color:#fff;} .notes_msg{color:green; margin-left:20px; margin-top:15px;} .right-menu .mui-btn { background-color:#b42573; } a.demo { background:#b42573; } li.heading { background:#b42573; } .course-box{background:#b42573} .home-intro-sub p{color:#b42573} a.demo{ top: 12px; float:right; } .prettyprint{ width: 99%; } </style> <script src="./Beautiful Soup Tutorial - Tutorialspoint_files/cse_element__en.js.download" type="text/javascript"></script><link href="./Beautiful Soup Tutorial - Tutorialspoint_files/default+en.css" rel="stylesheet" type="text/css"/><link href="./Beautiful Soup Tutorial - Tutorialspoint_files/default.css" rel="stylesheet" type="text/css"/><style type="text/css">.gsc-control-cse{font-family:arial, sans-serif}.gsc-control-cse .gsc-table-result{font-family:arial, sans-serif}.gsc-refinementsGradient{background:linear-gradient(to left,rgba(233,233,233,1),rgba(233,233,233,0))}</style><style type="text/css">.gscb_a{display:inline-block;font:27px/13px arial,sans-serif}.gsst_a .gscb_a{color:#a1b9ed;cursor:pointer}.gsst_a:hover .gscb_a,.gsst_a:focus .gscb_a{color:#36c}.gsst_a{display:inline-block}.gsst_a{cursor:pointer;padding:0 4px}.gsst_a:hover{text-decoration:none!important}.gsst_b{font-size:16px;padding:0 2px;position:relative;user-select:none;-webkit-user-select:none;white-space:nowrap}.gsst_e{vertical-align:middle;opacity:0.55;}.gsst_a:hover .gsst_e,.gsst_a:focus .gsst_e{opacity:0.72;}.gsst_a:active .gsst_e{opacity:1;}.gsst_f{background:white;text-align:left}.gsst_g{background-color:white;border:1px solid #ccc;border-top-color:#d9d9d9;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);margin:-1px -3px;padding:0 6px}.gsst_h{background-color:white;height:1px;margin-bottom:-1px;position:relative;top:-1px}.gsib_a{width:100%;padding:4px 6px 0}.gsib_a,.gsib_b{vertical-align:top}.gssb_c{border:0;position:absolute;z-index:989}.gssb_e{border:1px solid #ccc;border-top-color:#d9d9d9;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);cursor:default}.gssb_f{visibility:hidden;white-space:nowrap}.gssb_k{border:0;display:block;position:absolute;top:0;z-index:988}.gsdd_a{border:none!important}.gsq_a{padding:0}.gssb_a{padding:0 7px}.gssb_a,.gssb_a td{white-space:nowrap;overflow:hidden;line-height:22px}#gssb_b{font-size:11px;color:#36c;text-decoration:none}#gssb_b:hover{font-size:11px;color:#36c;text-decoration:underline}.gssb_g{text-align:center;padding:8px 0 7px;position:relative}.gssb_h{font-size:15px;height:28px;margin:0.2em;-webkit-appearance:button}.gssb_i{background:#eee}.gss_ifl{visibility:hidden;padding-left:5px}.gssb_i .gss_ifl{visibility:visible}a.gssb_j{font-size:13px;color:#36c;text-decoration:none;line-height:100%}a.gssb_j:hover{text-decoration:underline}.gssb_l{height:1px;background-color:#e5e5e5}.gssb_m{color:#000;background:#fff}.gssb_a{padding:0 9px}.gsib_a{padding:5px 9px 4px 9px}.gscb_a{line-height:27px}.gssb_e{border:0}.gssb_l{margin:5px 0}input.gsc-input::-webkit-input-placeholder{font-size:14px}input.gsc-input:-moz-placeholder{font-size:14px}input.gsc-input::-moz-placeholder{font-size:14px}input.gsc-input:-ms-input-placeholder{font-size:14px}input.gsc-input:focus::-webkit-input-placeholder{color:transparent}input.gsc-input:focus:-moz-placeholder{color:transparent}input.gsc-input:focus::-moz-placeholder{color:transparent}input.gsc-input:focus:-ms-input-placeholder{color:transparent}.gssb_c .gsc-completion-container{position:static}.gssb_c{z-index:5000}.gsc-completion-container table{background:transparent;font-size:inherit;font-family:inherit}.gssb_c > tbody > tr,.gssb_c > tbody > tr > td,.gssb_d,.gssb_d > tbody > tr,.gssb_d > tbody > tr > td,.gssb_e,.gssb_e > tbody > tr,.gssb_e > tbody > tr > td{padding:0;margin:0;border:0}.gssb_a table,.gssb_a table tr,.gssb_a table tr td{padding:0;margin:0;border:0}</style><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/pb.1620913454202.js.download" type="text/javascript"></script><script type="text/javascript">// refreshTypes: { // 1: "Active View", -> this is default // 2: "Active Tab", // 3: "BG" // } !(function () { var REFRESH_COUNTRY_MAP = { US: { //This is the country code where the given refesh is supposed to be applicable. To make it applicable across all countries use "default" in place of country code refreshInterval: 75, // this is in seconds refreshType: 3, sectionIdsToRefresh: ['f0f6cff6-393d-4170-b63a-d9ff06ca9f25', '5c0affd5-724a-475c-bfcd-cecbc7660c36','8f8814c2-d64c-4d26-9cb9-543653c0b48f','8014640d-fd34-4b2e-9b1b-cc67234a2325'] //in case sectionIdsToRefresh list is empty it will be applicable on units/sections }, default: { refreshInterval: 30, refreshType: 2 } }; var adpushup = window.adpushup || {}; adpushup.que = window.adpushup.que || []; adpushup.que.push(function () { var customRefreshConfig = REFRESH_COUNTRY_MAP[adpushup.config.country] || REFRESH_COUNTRY_MAP['default']; customRefreshConfig.refreshType = customRefreshConfig.refreshType || REFRESH_COUNTRY_MAP['default'].refreshType; customRefreshConfig.refreshInterval = customRefreshConfig.refreshInterval || REFRESH_COUNTRY_MAP['default'].refreshInterval; if (window.location.search.indexOf('apDebug=true') !== -1) { window.currentRefreshConfig = customRefreshConfig; window.REFRESH_COUNTRY_MAP = REFRESH_COUNTRY_MAP; } var isUnitToBeRefreshed = function (sectionId, sectionIdsToRefresh) { return !sectionIdsToRefresh.length || sectionIdsToRefresh.indexOf(sectionId) !== -1; }; var setupRefreshIntervalTimeForUnits = function (customRefreshConfig) { // Handle refreshInterval Innovative ads adpushup.config.innovativeAds.forEach(function (ad) { if (ad.networkData.refreshSlot && isUnitToBeRefreshed(ad.id, customRefreshConfig.sectionIdsToRefresh)) { ad.networkData.refreshInterval = customRefreshConfig.refreshInterval; } }); // Handle refreshInterval Manual Ads adpushup.config.manualAds.forEach(function (ad, i) { if (ad.networkData.refreshSlot && isUnitToBeRefreshed(ad.id, customRefreshConfig.sectionIdsToRefresh)) { ad.networkData.refreshInterval = customRefreshConfig.refreshInterval; } }); //Handle refreshInterval Layout Ads var experiment = adpushup.config.experiment; for (var device in experiment) { for (var page_group in experiment[device]) { experiment[device][page_group].variations.forEach(function (variation, j) { variation.ads.forEach(function (ad) { if ( ad.networkData.refreshSlot && isUnitToBeRefreshed(ad.id, customRefreshConfig.sectionIdsToRefresh) ) { ad.networkData.refreshInterval = customRefreshConfig.refreshInterval; } }); }); } } }; var setupUtilsCheckElementInViewPercentFn = function (customRefreshConfig) { var utils = window.adpushup.utils; var originalCheckElementInViewPercent = utils.checkElementInViewPercent.bind(utils); //overwrite the function window.adpushup.utils.checkElementInViewPercent = function (el) { var $el = window.adpushup.$(el); var elementOrigId = !!$el.data() ? $el.data().origId : ''; if (elementOrigId && isUnitToBeRefreshed(elementOrigId, customRefreshConfig.sectionIdsToRefresh)) { switch (customRefreshConfig.refreshType) { case 1: utils.log(`ActiveView Refresh for ${elementOrigId}`); return originalCheckElementInViewPercent(el); case 2: utils.log(`ActiveTab refresh for ${elementOrigId}`); if (document.hasFocus()) { return true; } break; case 3: utils.log(`BG refresh for ${elementOrigId}`); return true; break; } } else { utils.log(`ActiveView refresh for ${elementOrigId}`); return originalCheckElementInViewPercent(el); } }; }; if (customRefreshConfig && customRefreshConfig.sectionIdsToRefresh) { setupRefreshIntervalTimeForUnits(customRefreshConfig); setupUtilsCheckElementInViewPercentFn(customRefreshConfig); } }); })(); !(function () { window._apPbJs = window._apPbJs || {}; window._apPbJs.que = window._apPbJs.que || []; var enabledBidders = adpushup.utils.getQueryParams().enabledBidders; if (enabledBidders) { enabledBiddersArray = enabledBidders.split(","); window.adpushup.utils.log(enabledBiddersArray); window._apPbJs.que.push(function () { window._apPbJs.onEvent("beforeRequestBids", function (adunits) { var filteredAdUnits = []; for (var i = 0; i < adunits.length; i++) { var bidders = []; var adUnit = adunits[i]; var adUnitBids = adUnit.bids; for (var j = 0; j < adUnitBids.length; j++) { if (enabledBiddersArray.indexOf(adUnitBids[j].bidder) !== -1) { bidders.push(adUnitBids[j]); } } adUnit.bids = bidders; filteredAdUnits.push(adUnit); } adunits = filteredAdUnits; }); }); } })(); !(function () { window._apPbJs = window._apPbJs || {}; window._apPbJs.que = window._apPbJs.que || []; var bidderFilter = function (adunits) { console.log(adunits); }; var auctionEndCallback = function (auction) { window.adpushup.utils.log(auction); }; window._apPbJs.que.push(function () { // window._apPbJs.onEvent("beforeRequestBids", bidderFilter); window._apPbJs.onEvent("auctionEnd", auctionEndCallback); }); })(); </script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/gpt.js.download"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/apstag.js.download"></script><script type="text/javascript">(function($){ var $els = $('div[id^="STICKY"]'); $els.each(function(i,$el){ var span = $('<span style="cursor:pointer; position: absolute; top: -20px; right: 0; background: rgba(255,255,255,0.3); color: #000; padding: 0 5px;"> Close</span>'); $($el).append(span); span.on('click',function(){ $(this).parents('.adp_interactive_ad').remove(); }) }) })(adpushup.$)</script><meta content="A+b/H0b8RPXNaJgaNFpO0YOFuGK6myDQXlwnJB3SwzvNMfcndat4DZYMrP4ClJIzYWo3/yP2S+8FTZ/lpqbPAAEAAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=" http-equiv="origin-trial"/><meta content="A9ZgbRtm4pU3oZiuNzOsKcC8ppFSZdcjP2qYcdQrFKVzkmiWH1kdYY1Mi9x7G8+PS8HV9Ha9Cz0gaMdKsiVZIgMAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AxL6oBxcpn5rQDPKSAs+d0oxNyJYq2/4esBUh3Yx5z8QfcLu+AU8iFCXYRcr/CEEfDnkxxLTsvXPJFQBxHfvkgMAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="A9KPtG5kl3oLTk21xqynDPGQ5t18bSOpwt0w6kGa6dEWbuwjpffmdUpR3W+faZDubGT+KIk2do0BX2ca16x8qAcAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="A3HucHUo1oW9s+9kIKz8mLkbcmdaj5lxt3eiIMp1Nh49dkkBlg1Fhg4Fd/r0vL69mRRA36YutI9P/lJUfL8csQoAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==" http-equiv="origin-trial"/><meta content="A0OysezhLoCRYomumeYlubLurZTCmsjTb087OvtCy95jNM65cfEsbajrJnhaGwiTxhz38ZZbm+UhUwQuXfVPTg0AAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==" http-equiv="origin-trial"/><meta content="AxoOxdZQmIoA1WeAPDixRAeWDdgs7ZtVFfH2y19ziTgD1iaHE5ZGz2UdSjubkWvob9C5PrjUfkWi4ZSLgWk3Xg8AAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==" http-equiv="origin-trial"/><meta content="A7+rMYR5onPnACrz+niKSeFdH3xw1IyHo2AZSHmxrofRk9w4HcQPMYcpBUKu6OQ6zsdxf4m/vqa6tG6Na4OLpAQAAAB4eyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AwfG8hAcHnPa/kJ1Co0EvG/K0F9l1s2JZGiDLt2mhC3QI5Fh4qmsmSwrWObZFbRC9ieDaSLU6lHRxhGUF/i9sgoAAACBeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AwQ7dCmHkvR6FuOFxAuNnktYSQrGbL4dF+eBkrwNLALc69Wr//PnO1yzns3pjUoCaYbKHtVcnng2hU+8OUm0PAYAAACHeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AysVDPGQTLD/Scn78x4mLwB1tMfje5jwUpAAzGRpWsr1NzoN7MTFhT3ClmImi2svDZA7V6nWGIV8YTPsSRTe0wYAAACHeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/pubads_impl_2021051801.js.download"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" type="text/javascript"></script><link href="https://d59ab0395fb486e599b489899dd42585.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html" rel="prefetch"/><link href="https://tpc.googlesyndication.com/safeframe/1-0-38/html/container.html" rel="prefetch"/><script type="text/javascript">(function($){ })(adpushup.$)</script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" type="text/javascript"></script></head> <body data-gr-ext-installed="" data-new-gr-c-s-check-loaded="14.1012.0"> <header id="header"> <!-- pop-up --> <div class="pop-modal overlay-pop popdiv" style="display: none;"> <div class="modal-window small"> <span class="close" title="close">×</span> <div class="pop-content"> </div> <span class="msg"></span> </div> </div> <div class="wrap_loader"> <div class="imgLoader"><img alt="Tutorialspoint" height="70" src="./Beautiful Soup Tutorial - Tutorialspoint_files/loader.gif" width="70"/></div> </div> <input id="vu" name="vu" type="hidden" value=""/> <!-- pop-up --> <!-- Top sub-menu Starts Here --> <div class="mui-appbar mui-container-fulid top-menu"> <div class="mui-container"> <div class="top-menu-item home"> <a href="https://www.tutorialspoint.com/index.htm" target="_blank" title="TutorialsPoint - Home"><i class="fal fa-home"></i> <span>Home</span></a> </div> <div class="top-menu-item qa"> <a href="https://www.tutorialspoint.com/about/about_careers.htm" target="_blank" title="Job @ Tutorials Point"><i class="fa fa-suitcase"></i> <span>Jobs</span></a> </div> <div class="top-menu-item tools"> <a href="https://www.tutorialspoint.com/online_dev_tools.htm" target="_blank" title="Tools - Online Development and Testing Tools"><i class="fal fa-cogs"></i> <span>Tools</span></a> </div> <div class="top-menu-item coding-ground"> <a href="https://www.tutorialspoint.com/codingground.htm" target="_blank" title="Coding Ground - Free Online IDE and Terminal"><i class="fal fa-code"></i> <span>Coding Ground </span></a> </div> <div class="top-menu-item current-affairs"> <a href="https://www.tutorialspoint.com/current_affairs.htm" target="_blank" title="Daily Current Affairs"><i class="fal fa-layer-plus"></i> <span>Current Affairs</span></a> </div> <div class="top-menu-item upsc-notes"> <a href="https://www.tutorialspoint.com/upsc_ias_exams.htm" target="_blank" title="UPSC IAS Exams Notes - TutorialsPoint"><i class="fal fa-user-tie"></i> <span>UPSC Notes</span></a> </div> <div class="top-menu-item articles"> <a href="https://www.tutorialspoint.com/tutor_connect/index.php" target="_blank" title="Top Online Tutors - Tutor Connect"><i class="fal fa-user"></i> <span>Online Tutors</span></a> </div> <div class="top-menu-item whiteboard"> <a href="https://www.tutorialspoint.com/whiteboard.htm" target="_blank" title="Free Online Whiteboard"><i class="fal fa-chalkboard"></i> <span>Whiteboard</span></a> </div> <div class="top-menu-item net-meeting"> <a href="https://www.tutorialspoint.com/netmeeting.php" target="_blank" title="A free tool for online video conferencing"><i class="fal fa-chalkboard-teacher"></i> <span>Net Meeting</span></a> </div> <div class="top-menu-item articles"> <a href="https://www.tutorix.com/" rel="nofollow" target="_blank" title="Tutorx - The Best Learning App"><i class="fal fa-video"></i> <span>Tutorix</span></a> </div> <div class="top-menu-item qa login"> <a href="https://www.tutorialspoint.com/videotutorials/login.php" target="_blank" title="Tutorials Point - Login"><i class="fa fa-sign-in-alt"></i> <span>Login</span></a> </div> <div class="top-menu-item qa login"> <a href="https://www.tutorialspoint.com/videotutorials/subscription.php" target="_blank" title="Paid Package"><i class="fa fa-book-reader"></i> <span>Packages</span></a> </div> <div class="social-menu-item"> <a data-placement="bottom" href="https://www.facebook.com/tutorialspointindia" rel="nofollow" target="_blank" title="tutorialspoint @ Facebook"><i class="fab fa-facebook-f"></i></a> <a data-placement="bottom" href="https://www.twitter.com/tutorialspoint" rel="nofollow" target="_blank" title="tutorialspoint @ Twitter"><i class="fab fa-twitter"></i></a> <a data-placement="bottom" href="https://www.linkedin.com/company/tutorialspoint" rel="nofollow" target="_blank" title="tutorialspoint @ Linkedin"><i class="fab fa-linkedin-in"></i></a> <a data-placement="bottom" href="https://www.youtube.com/channel/UCVLbzhxVTiTLiVKeGV7WEBg" rel="nofollow" target="_blank" title="tutorialspoint YouTube"><i class="fab fa-youtube"></i></a> </div> </div> </div> <!-- Top sub-menu Ends Here --> <!-- Top main-menu Starts Here --> <div class="mui-appbar mui-container-fulid mui--appbar-line-height mui--z1" id="logo-menu"> <div class="mui-container"> <div class="left-menu"> <a href="https://www.tutorialspoint.com/index.htm" title="Tutorialspoint"> <img alt="tutorialspoint" class="tp-logo" src="./Beautiful Soup Tutorial - Tutorialspoint_files/logo.png"/> </a> <div class="mui-dropdown"> <a class="mui-btn mui-btn--primary categories" data-mui-toggle="dropdown"><i class="fa fa-th-large"></i> <span>Categories <span class="mui-caret"></span></span></a> <ul class="mui-dropdown__menu cat-menu"> <li> <ul> <li><a href="https://www.tutorialspoint.com/academic_tutorials.htm"><i class="fa fa-caret-right"></i> Academic Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/big_data_tutorials.htm"><i class="fa fa-caret-right"></i> Big Data & Analytics </a></li> <li><a href="https://www.tutorialspoint.com/computer_programming_tutorials.htm"><i class="fa fa-caret-right"></i> Computer Programming </a></li> <li><a href="https://www.tutorialspoint.com/computer_science_tutorials.htm"><i class="fa fa-caret-right"></i> Computer Science </a></li> <li><a href="https://www.tutorialspoint.com/database_tutorials.htm"><i class="fa fa-caret-right"></i> Databases </a></li> <li><a href="https://www.tutorialspoint.com/devops_tutorials.htm"><i class="fa fa-caret-right"></i> DevOps </a></li> <li><a href="https://www.tutorialspoint.com/digital_marketing_tutorials.htm"><i class="fa fa-caret-right"></i> Digital Marketing </a></li> <li><a href="https://www.tutorialspoint.com/engineering_tutorials.htm"><i class="fa fa-caret-right"></i> Engineering Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm"><i class="fa fa-caret-right"></i> Exams Syllabus </a></li> <li><a href="https://www.tutorialspoint.com/famous_monuments.htm"><i class="fa fa-caret-right"></i> Famous Monuments </a></li> <li><a href="https://www.tutorialspoint.com/gate_exams_tutorials.htm"><i class="fa fa-caret-right"></i> GATE Exams Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/latest_technologies.htm"><i class="fa fa-caret-right"></i> Latest Technologies </a></li> <li><a href="https://www.tutorialspoint.com/machine_learning_tutorials.htm"><i class="fa fa-caret-right"></i> Machine Learning </a></li> <li><a href="https://www.tutorialspoint.com/mainframe_tutorials.htm"><i class="fa fa-caret-right"></i> Mainframe Development </a></li> <li><a href="https://www.tutorialspoint.com/management_tutorials.htm"><i class="fa fa-caret-right"></i> Management Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/maths_tutorials.htm"><i class="fa fa-caret-right"></i> Mathematics Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/microsoft_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> Microsoft Technologies </a></li> <li><a href="https://www.tutorialspoint.com/misc_tutorials.htm"><i class="fa fa-caret-right"></i> Misc tutorials </a></li> <li><a href="https://www.tutorialspoint.com/mobile_development_tutorials.htm"><i class="fa fa-caret-right"></i> Mobile Development </a></li> <li><a href="https://www.tutorialspoint.com/java_technology_tutorials.htm"><i class="fa fa-caret-right"></i> Java Technologies </a></li> <li><a href="https://www.tutorialspoint.com/python_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> Python Technologies </a></li> <li><a href="https://www.tutorialspoint.com/sap_tutorials.htm"><i class="fa fa-caret-right"></i> SAP Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/scripting_lnaguage_tutorials.htm"><i class="fa fa-caret-right"></i>Programming Scripts </a></li> <li><a href="https://www.tutorialspoint.com/selected_reading.htm"><i class="fa fa-caret-right"></i> Selected Reading </a></li> <li><a href="https://www.tutorialspoint.com/software_quality_tutorials.htm"><i class="fa fa-caret-right"></i> Software Quality </a></li> <li><a href="https://www.tutorialspoint.com/soft_skill_tutorials.htm"><i class="fa fa-caret-right"></i> Soft Skills </a></li> <li><a href="https://www.tutorialspoint.com/telecom_tutorials.htm"><i class="fa fa-caret-right"></i> Telecom Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm"><i class="fa fa-caret-right"></i> UPSC IAS Exams </a></li> <li><a href="https://www.tutorialspoint.com/web_development_tutorials.htm"><i class="fa fa-caret-right"></i> Web Development </a></li> <li><a href="https://www.tutorialspoint.com/sports_tutorials.htm"><i class="fa fa-caret-right"></i> Sports Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/xml_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> XML Technologies </a></li> <li><a href="https://www.tutorialspoint.com/multi_language_tutorials.htm"><i class="fa fa-caret-right"></i> Multi-Language</a></li> <li><a href="https://www.tutorialspoint.com/questions_and_answers.htm"><i class="fa fa-caret-right"></i> Interview Questions</a></li> </ul> </li> </ul> <div class="clear"></div> </div> </div> <div class="right-menu"> <div class="toc-toggle"> <a href="javascript:void(0);"><i class="fa fa-bars"></i></a> </div> <div class="mobile-search-btn"> <a href="https://www.tutorialspoint.com/index.htm"><i class="fal fa-search"></i></a> </div> <div class="search-box"> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(2).txt"></script> <div id="___gcse_0"><div class="gsc-control-cse gsc-control-cse-en"><div class="gsc-control-wrapper-cse" dir="ltr"><form accept-charset="utf-8" class="gsc-search-box gsc-search-box-tools"><table cellpadding="0" cellspacing="0" class="gsc-search-box"><tbody><tr><td class="gsc-input"><div class="gsc-input-box" id="gsc-iw-id1"><table cellpadding="0" cellspacing="0" class="gstl_50 gsc-input" id="gs_id50" style="width: 100%; padding: 0px;"><tbody><tr><td class="gsib_a" id="gs_tti50"><input autocomplete="off" class="gsc-input" dir="ltr" id="gsc-i-id1" name="search" size="10" spellcheck="false" style='width: 100%; padding: 0px; border: none; margin: 0px; height: auto; background: url("https://www.google.com/cse/static/images/1x/en/branding.png") left center no-repeat rgb(255, 255, 255); outline: none;' title="search" type="text"/></td><td class="gsib_b"><div class="gsst_b" dir="ltr" id="gs_st50"><a class="gsst_a" href="javascript:void(0)" role="button" style="display: none;" title="Clear search box"><span aria-hidden="true" class="gscb_a" id="gs_cb50">×</span></a></div></td></tr></tbody></table></div></td><td class="gsc-search-button"><button class="gsc-search-button gsc-search-button-v2"><svg height="13" viewbox="0 0 13 13" width="13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg></button></td><td class="gsc-clear-button"><div class="gsc-clear-button" title="clear results"> </div></td></tr></tbody></table></form><div class="gsc-results-wrapper-overlay"><div class="gsc-results-close-btn" tabindex="0"></div><div class="gsc-positioningWrapper"><div class="gsc-tabsAreaInvisible"><div aria-label="refinement" class="gsc-tabHeader gsc-inline-block gsc-tabhActive" role="tab">Custom Search</div><span class="gs-spacer"> </span></div></div><div class="gsc-positioningWrapper"><div class="gsc-tabsAreaInvisible"></div></div><div class="gsc-above-wrapper-area-invisible"><table cellpadding="0" cellspacing="0" class="gsc-above-wrapper-area-container"><tbody><tr><td class="gsc-result-info-container"><div class="gsc-result-info-invisible"></div></td><td class="gsc-orderby-container"><div class="gsc-orderby-invisible"><div class="gsc-orderby-label gsc-inline-block">Sort by:</div><div class="gsc-option-menu-container gsc-inline-block"><div class="gsc-selected-option-container gsc-inline-block"><div class="gsc-selected-option">Relevance</div><div class="gsc-option-selector"></div></div><div class="gsc-option-menu-invisible"><div class="gsc-option-menu-item gsc-option-menu-item-highlighted"><div class="gsc-option">Relevance</div></div><div class="gsc-option-menu-item"><div class="gsc-option">Date</div></div></div></div></div></td></tr></tbody></table></div><div class="gsc-adBlockInvisible"></div><div class="gsc-wrapper"><div class="gsc-adBlockInvisible"></div><div class="gsc-resultsbox-invisible"><div class="gsc-resultsRoot gsc-tabData gsc-tabdActive"><div><div class="gsc-expansionArea"></div></div></div></div></div></div><div class="gsc-modal-background-image" tabindex="0"></div></div></div></div> </div> <div class="menu-btn library-btn"> <a href="https://www.tutorialspoint.com/tutorialslibrary.htm"><i class="fal fa-cubes"></i> <span>Library</span></a> </div> <div class="menu-btn videos-btn"> <a href="https://www.tutorialspoint.com/videotutorials/index.php"><i class="fal fa-video"></i> <span>Videos</span></a> </div> <div class="menu-btn videos-btn"> <a href="https://www.tutorialspoint.com/questions/index.php"><i class="fa fa-location-arrow"></i> <span>Q/A</span></a> </div> <div class="menu-btn ebooks-btn"> <a href="https://store.tutorialspoint.com/"><i class="fal fa-book"></i> <span>eBooks</span></a> </div> <div class="mui-dropdown"> <button class="mui-btn mui-btn--primary mobile-menu" data-mui-toggle="dropdown" type="button"> <span class="mui-caret"></span> </button> <ul class="mui-dropdown__menu"> <li class="login"><a href="https://www.tutorialspoint.com/videotutorials/login.php"><i class="fal fa-sign-in-alt"></i> <span>Login</span></a></li> <li><a href="https://www.tutorialspoint.com/tutorialslibrary.htm"><i class="fal fa-cubes"></i> <span>Library</span></a></li> <li><a href="https://www.tutorialspoint.com/videotutorials/index.php"><i class="fal fa-video"></i> <span>Videos</span></a></li> <li><a href="https://store.tutorialspoint.com/"><i class="fal fa-book"></i> <span>eBooks</span></a></li> </ul> </div> </div> </div> </div> <!-- Top main-menu Ends Here --> </header> <div class="mui-container-fluid content"> <div class="mui-container"> <!-- Tutorial ToC Starts Here --> <div class="mui-col-md-3 tutorial-toc"> <div class="mini-logo"> <img alt="Beautiful Soup Tutorial" src="./Beautiful Soup Tutorial - Tutorialspoint_files/beautifulsoup-mini-logo.jpg"/> </div> <ul class="toc chapters"> <li class="heading">Beautiful Soup Tutorial</li> <li style="background-color: rgb(214, 214, 214);"><a href="https://www.tutorialspoint.com/beautiful_soup/index.htm">Beautiful Soup - Home</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_overview.htm">Beautiful Soup - Overview</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_installation.htm">Beautiful Soup - Installation</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_souping_the_page.htm">Beautiful Soup - Souping the Page</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_kinds_of_objects.htm">Beautiful Soup - Kinds of objects</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_navigating_by_tags.htm">Beautiful Soup - Navigating by Tags</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_searching_the_tree.htm">Beautiful Soup - Searching the Tree</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_modifying_the_tree.htm">Beautiful Soup - Modifying the Tree</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_encoding.htm">Beautiful Soup - Encoding</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_beautiful_objects.htm">Beautiful Soup - Beautiful Objects</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_parsing_only_section_of_a_document.htm">Parsing Only Section of a Document</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_trouble_shooting.htm">Beautiful Soup - Trouble Shooting</a></li> <li class="heading">Beautiful Soup Useful Resources</li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_quick_guide.htm">Beautiful Soup - Quick Guide</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_useful_resources.htm">Beautiful Soup - Useful Resources</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_discussion.htm">Beautiful Soup - Discussion</a></li> </ul> <ul class="toc reading"> <li class="sreading">Selected Reading</li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm" target="_top">UPSC IAS Exams Notes</a></li> <li><a href="https://www.tutorialspoint.com/developers_best_practices/index.htm" target="_top">Developer's Best Practices</a></li> <li><a href="https://www.tutorialspoint.com/questions_and_answers.htm" target="_top">Questions and Answers</a></li> <li><a href="https://www.tutorialspoint.com/effective_resume_writing.htm" target="_top">Effective Resume Writing</a></li> <li><a href="https://www.tutorialspoint.com/hr_interview_questions/index.htm" target="_top">HR Interview Questions</a></li> <li><a href="https://www.tutorialspoint.com/computer_glossary.htm" target="_top">Computer Glossary</a></li> <li><a href="https://www.tutorialspoint.com/computer_whoiswho.htm" target="_top">Who is Who</a></li> </ul> <div id="stickyparent" style="position: sticky;"> <div id="sticky-ad" style="height:250px;width:300px;"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="430c9911-782f-495d-88f9-69f58ca8c9a4" data-render-time="1621759319394" data-section="00000001-714f4f1d-1516-4e67-b7e2-913e26f06b24" id="00000001-714f4f1d-1516-4e67-b7e2-913e26f06b24" style="text-align: center; margin: 10px auto; width: 300px; height: 250px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("430c9911-782f-495d-88f9-69f58ca8c9a4"); }); </script> <div data-google-query-id="CNvGh6O03_ACFVTcjwodn4AC-A" id="ADP_40046_300x250_00000001-714f4f1d-1516-4e67-b7e2-913e26f06b24" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21875371528_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="1" data-load-complete="true" frameborder="0" height="250" id="google_ads_iframe_/103512698/21875371528_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21875371528_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource.html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> </div> </div> <!-- Tutorial ToC Ends Here --> <!-- Tutorial Content Starts Here --> <div class="mui-col-md-6 tutorial-content"> <div class="cover"> <img alt="Beautiful Soup Tutorial" class="img-responsive" src="./Beautiful Soup Tutorial - Tutorialspoint_files/beautifulsoup.jpg" style="width:100%; margin-top: 15px;"/> </div> <h1>Beautiful Soup Tutorial</h1> <div class="clearer"></div> <div class="tutorial-home-menu"> <form action="https://www.tutorialspoint.com/job_search.php" method="POST"> <input name="search_string" type="hidden" value="Beautiful Soup"/> <button class="tp-btn"><i class="fal fa-file-pdf"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_pdf_version.htm"> PDF Version</a></button> <button class="tp-btn"><i class="fal fa-book-reader"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_quick_guide.htm"> Quick Guide</a></button> <button class="tp-btn"><i class="fal fa-external-link"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_useful_resources.htm"> Resources</a></button> <button class="tp-btn" type="submit"><i class="fal fa-search-dollar"></i> Job Search</button> <button class="tp-btn"><i class="fal fa-comments"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_discussion.htm"> Discussion</a></button> </form> </div> <p>In this tutorial, we will show you, how to perform web scraping in Python using Beautiful Soup 4 for getting data out of HTML, XML and other markup languages. In this we will try to scrap webpage from various different websites (including IMDB). We will cover beautiful soup 4, python basic tools for efficiently and clearly navigating, searching and parsing HTML web page. We have tried to cover almost all the functionalities of Beautiful Soup 4 in this tutorial. You can combine multiple functionalities introduced in this tutorial into one bigger program to capture multiple meaningful data from the website into some other sub-program as input.</p> <h1>Audience</h1> <p>This tutorial is basically designed to guide you in scarping a web page. Basic requirement of all this is to get meaningful data out of huge unorganized set of data. The target audience of this tutorial can be anyone of:</p> <ul class="list"> <li><p>Anyone who wants to know – how to scrap webpage in python using BeautifulSoup 4.</p></li> <li><p>Any data science developer/enthusiasts or anyone, how wants to use this scraped (meaningful) data to different python data science libraries to make better decision.</p></li> </ul> <h1>Prerequisites</h1> <p>Though there is NO mandatory requirement to have for this tutorial. However, if you have any or all (supercool) prior knowledge on any below mentioned technologies that will be an added advantage −</p> <ul class="list"> <li><p>Knowledge of any web related technologies (HTML/CSS/Document object Model etc.).</p></li> <li><p>Python Language (as it is the python package).</p></li> <li><p>Developers who have any prior knowledge of scraping in any language.</p></li> <li><p>Basic understanding of HTML tree structure.</p></li> </ul> <div class="mui-container-fluid button-borders show" id="bottom_navigation"> <div class="pre-btn"> <a href="https://www.tutorialspoint.com/beautiful_soup/index.htm"><i class="fal fa-chevron-circle-left"></i> Previous Page</a> <a class="hide-on-mobile" href="javascript:printPage();"><i class="fa fa-print"></i> Print Page</a> </div> <div class="nxt-btn"> <a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_overview.htm">Next Page <i class="fal fa-chevron-circle-right"></i> </a> </div> </div> <div class="space-bottom" style="margin-bottom:20px;"></div> <div class="google-bottom-ads" id="google-bottom-ads"> <div>Advertisements</div> <div> <div id="adp_bottom_ads"><div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="e7ddd6f7-1ab0-494a-bade-887daa4373a0" data-render-time="1621759319402" data-section="00000001-6972cd1e-4b56-40f1-b912-4d188fba4946" id="00000001-6972cd1e-4b56-40f1-b912-4d188fba4946" style="text-align: center; margin: 10px auto; width: 580px; height: 400px; overflow: hidden; display: block;"><div data-google-query-id="CNzGh6O03_ACFVTcjwodn4AC-A" id="ADP_40046_580x400_00000001-6972cd1e-4b56-40f1-b912-4d188fba4946" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/ADP_40046_580X400_e7ddd6f7-1ab0-494a-bade-887daa4373a0_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="2" data-load-complete="true" frameborder="0" height="400" id="google_ads_iframe_/103512698/ADP_40046_580X400_e7ddd6f7-1ab0-494a-bade-887daa4373a0_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/ADP_40046_580X400_e7ddd6f7-1ab0-494a-bade-887daa4373a0_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(1).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="580"></iframe></div></div></div></div> <script> var adPos = document.getElementById('adp_bottom_ads'); var mobile_ad_id = "a8a632a6-046e-4f5c-b25f-8bc82ac89fb2"; var desktop_ad_id = "e7ddd6f7-1ab0-494a-bade-887daa4373a0"; var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { var ad_id = window.innerWidth <= 768 ? mobile_ad_id : desktop_ad_id; adPos.innerHTML = '<div id="' + ad_id + '" class="_ap_apex_ad"></div>'; adpushup.triggerAd(ad_id); }); </script> </div> <div class="space-bottom"></div> </div> </div> <!-- Tutorial Content Ends Here --> <!-- Right Column Starts Here --> <div class="mui-col-md-2 google-right-ads" id="chapter-menu" style="display: none;"> <input id="vu" name="vu" type="hidden" value=""/> <div class="space-top"></div> <div class="mui-panel"> <ul class="paid-menu" id="div-right-menu"> <li><a class="hide-on-mobile" href="javascript:printPage();" title="Print this page"><i class="fa fa-print"></i> Print</a></li> <li><a class="add_notes" href="javascript:void(0)" onclick="add_notes();" title="Add Custom Notes"><i class="fa fa-edit"></i> Add Notes</a></li> <li><a class="clsPage text-bookmark" href="javascript:void(0)" id="text-bookmark" onclick="text_bookmark()" title="Add Bookmark"><i class="fal fa-bookmark"></i> Bookmark this page </a></li> <li><a href="javascript:void(0);" id="report_error_popup" onclick="report_error_popup();" title="Report Error"><i class="fal fa-bell"></i> Report Error</a></li> <li><a href="javascript:void(0);" id="suggestion_popup" onclick="suggestion_popup();" title="Give Suggestions"><i class="fal fa-badge-check"></i> Suggestions</a></li> </ul> <div class="profile-my-notes" id="text_notes_div" style="display:none;"> <textarea class="text_notes" id="text_notes" name="text_notes" placeholder="Enter your custom notes..." rows="10"></textarea> <br/> <a class="butn-save" href="javascript:void(0);" id="submit_text_notes" onclick="submit_text_notes();"> Save</a> <a class="pop-no butn-cancel" href="javascript:void(0);" onclick="notesClose();"> Close</a> <p class="notes_msg"></p> </div> <div class="bottom-menu"> <button class="tp-btn"><i class="fal fa-box-up"></i> <a href="https://www.tutorialspoint.com/videotutorials/dashboard.php">Dashboard</a></button> <button class="tp-btn"><i class="fal fa-sign-out-alt"></i> <a href="https://www.tutorialspoint.com/videotutorials/userlogout.php">Logout</a></button> </div> </div> </div> <div class="mui-col-md-2 google-right-ads" id="google-right-ads"> <div class="space-top"></div> <div class="google-right-ad" style="margin: 0px auto !important;margin-top:5px;min-height:250px!important"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="f0f6cff6-393d-4170-b63a-d9ff06ca9f25" data-refresh-time="1621760401638" data-render-time="1621759319405" data-section="00000001-77807d47-104e-457e-8302-ed3f4612fa90" data-timeout="233" id="00000001-77807d47-104e-457e-8302-ed3f4612fa90" style="text-align: center; margin: 10px auto; width: 300px; height: 250px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("f0f6cff6-393d-4170-b63a-d9ff06ca9f25"); }); </script> <div data-google-query-id="CIOkpqa43_ACFY0UjwodY4QF-g" id="ADP_40046_300x250_00000001-77807d47-104e-457e-8302-ed3f4612fa90" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21871305451_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="8" data-load-complete="true" frameborder="0" height="250" id="google_ads_iframe_/103512698/21871305451_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21871305451_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(2).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> <div class="google-right-ad" style="margin-top:16px;min-height:250px!important"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="5c0affd5-724a-475c-bfcd-cecbc7660c36" data-refresh-time="1621760401642" data-render-time="1621759319407" data-section="00000001-ef31da0f-9822-401f-be58-4ee0e808e24c" data-timeout="235" id="00000001-ef31da0f-9822-401f-be58-4ee0e808e24c" style="text-align: center; margin: 10px auto; width: 300px; height: 250px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("5c0affd5-724a-475c-bfcd-cecbc7660c36"); }); </script> <div data-google-query-id="CJjno6a43_ACFY0UjwodY4QF-g" id="ADP_40046_300x250_00000001-ef31da0f-9822-401f-be58-4ee0e808e24c" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21871305739_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="9" data-load-complete="true" frameborder="0" height="250" id="google_ads_iframe_/103512698/21871305739_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21871305739_0" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(3).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> <div class="google-right-ad" style="margin-top:16px;margin-bottom:15px;min-height:600px!important"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="8f8814c2-d64c-4d26-9cb9-543653c0b48f" data-render-time="1621759319409" data-section="00000001-00b877d5-3efd-43ad-b382-ac6898cf663d" id="00000001-00b877d5-3efd-43ad-b382-ac6898cf663d" style="text-align: center; margin: 10px auto; width: 300px; height: 600px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("8f8814c2-d64c-4d26-9cb9-543653c0b48f"); }); </script> <div data-google-query-id="CN_Gh6O03_ACFVTcjwodn4AC-A" id="ADP_40046_300x600_00000001-00b877d5-3efd-43ad-b382-ac6898cf663d" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21875371402_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="5" data-load-complete="true" frameborder="0" height="600" id="google_ads_iframe_/103512698/21875371402_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21875371402_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(4).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> <div class="space-bottom" style="margin-bottom:15px;"></div> </div> <!-- Right Column Ends Here --> </div> </div> <div class="clear"></div> <footer id="footer"> <div class="mui--text-center"> <div class="mui--text-caption mui--text-light"> <a class="logo" href="https://www.tutorialspoint.com/index.htm"><img alt="Tutorials Point" class="img-responsive" src="./Beautiful Soup Tutorial - Tutorialspoint_files/logo-black.png" title="Tutorials Point"/></a> </div> <ul class="mui-list--inline mui--text-body2 mui--text-light"> <li><a href="https://www.tutorialspoint.com/about/index.htm"><i class="fal fa-globe"></i> About us</a></li> <li><a href="https://www.tutorialspoint.com/about/return_refund_policy.htm"> <i class="fal fa-asterisk"></i> Refund Policy</a></li> <li><a href="https://www.tutorialspoint.com/about/about_terms_of_use.htm"><i class="fal fa-asterisk"></i> Terms of use</a></li> <li><a href="https://www.tutorialspoint.com/about/about_privacy.htm"> <i class="fal fa-shield-check"></i> Privacy Policy</a></li> <li><a href="https://www.tutorialspoint.com/about/faq.htm"><i class="fal fa-question-circle"></i> FAQ's</a></li> <li><a href="https://www.tutorialspoint.com/about/contact_us.htm"><i class="fal fa-map-marker-alt"></i> Contact</a></li> </ul> <div class="mui--text-caption mui--text-light bottom-copyright-text">© Copyright 2021. All Rights Reserved.</div> </div> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/js(1)"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-232293-6'); </script> <script src="./Beautiful Soup Tutorial - Tutorialspoint_files/text_menu.js.download"></script> <script> $(document).ready(function (){ var cval = readCookie('subscription_purchased'); if(cval == '1'){ // logged in and purchased subscription. $('#google-right-ads').remove(); $('#adp1').remove(); $('#adp2').remove(); $('#stickyparent').remove(); $('#google-top-ads').remove(); $('#adp_top_ads').remove(); $('#google-bottom-ads').remove(); $('.tutorial-content hr').remove(); $('.login').remove(); $('#chapter-menu').show(); $('.content h1').css("border-bottom", "none"); $('.google-right-ads').css("padding-right", "0px"); $('.tutorial-content').css("border-radius", "10px"); $('#chapter-menu .mui-panel').css("border-radius", "10px"); } }); </script> </footer> <table cellpadding="0" cellspacing="0" class="gstl_50 gssb_c" style="width: 213px; display: none; top: 91px; position: absolute; left: 1151px;"><tbody><tr><td class="gssb_f"></td><td class="gssb_e" style="width: 100%;"></td></tr></tbody></table><div id="highlighter--hover-tools" style="display: none;"> <div id="highlighter--hover-tools--container"> <div class="highlighter--icon highlighter--icon-copy" title="Copy"></div> <div class="highlighter--separator"></div> <div class="highlighter--icon highlighter--icon-change-color" title="Change Color"></div> <div class="highlighter--separator"></div> <div class="highlighter--icon highlighter--icon-delete" title="Delete"></div> </div> </div><iframe id="criteo-syncframe" src="./Beautiful Soup Tutorial - Tutorialspoint_files/syncframe.html" style="display: none;"></iframe><iframe id="google_osd_static_frame_3079649016572" name="google_osd_static_frame" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(5).html" style="display: none; width: 0px; height: 0px;"></iframe></body><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="1453ad4bda850f44" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/ixmatch.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="1461e0473fc86621" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(6).html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="147f415d7a18a173" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/pd.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="14873978b330cb4b" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/usync.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="1499e372c336a66f" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/showad.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="150b6de20b6fde28" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/async_usersync.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="151c6e0e9dc13e2" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/sync.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe></html>
print(soup.title)
<title>Beautiful Soup Tutorial - Tutorialspoint</title>
print(soup.header)
<header id="header"> <!-- pop-up --> <div class="pop-modal overlay-pop popdiv" style="display: none;"> <div class="modal-window small"> <span class="close" title="close">×</span> <div class="pop-content"> </div> <span class="msg"></span> </div> </div> <div class="wrap_loader"> <div class="imgLoader"><img alt="Tutorialspoint" height="70" src="./Beautiful Soup Tutorial - Tutorialspoint_files/loader.gif" width="70"/></div> </div> <input id="vu" name="vu" type="hidden" value=""/> <!-- pop-up --> <!-- Top sub-menu Starts Here --> <div class="mui-appbar mui-container-fulid top-menu"> <div class="mui-container"> <div class="top-menu-item home"> <a href="https://www.tutorialspoint.com/index.htm" target="_blank" title="TutorialsPoint - Home"><i class="fal fa-home"></i> <span>Home</span></a> </div> <div class="top-menu-item qa"> <a href="https://www.tutorialspoint.com/about/about_careers.htm" target="_blank" title="Job @ Tutorials Point"><i class="fa fa-suitcase"></i> <span>Jobs</span></a> </div> <div class="top-menu-item tools"> <a href="https://www.tutorialspoint.com/online_dev_tools.htm" target="_blank" title="Tools - Online Development and Testing Tools"><i class="fal fa-cogs"></i> <span>Tools</span></a> </div> <div class="top-menu-item coding-ground"> <a href="https://www.tutorialspoint.com/codingground.htm" target="_blank" title="Coding Ground - Free Online IDE and Terminal"><i class="fal fa-code"></i> <span>Coding Ground </span></a> </div> <div class="top-menu-item current-affairs"> <a href="https://www.tutorialspoint.com/current_affairs.htm" target="_blank" title="Daily Current Affairs"><i class="fal fa-layer-plus"></i> <span>Current Affairs</span></a> </div> <div class="top-menu-item upsc-notes"> <a href="https://www.tutorialspoint.com/upsc_ias_exams.htm" target="_blank" title="UPSC IAS Exams Notes - TutorialsPoint"><i class="fal fa-user-tie"></i> <span>UPSC Notes</span></a> </div> <div class="top-menu-item articles"> <a href="https://www.tutorialspoint.com/tutor_connect/index.php" target="_blank" title="Top Online Tutors - Tutor Connect"><i class="fal fa-user"></i> <span>Online Tutors</span></a> </div> <div class="top-menu-item whiteboard"> <a href="https://www.tutorialspoint.com/whiteboard.htm" target="_blank" title="Free Online Whiteboard"><i class="fal fa-chalkboard"></i> <span>Whiteboard</span></a> </div> <div class="top-menu-item net-meeting"> <a href="https://www.tutorialspoint.com/netmeeting.php" target="_blank" title="A free tool for online video conferencing"><i class="fal fa-chalkboard-teacher"></i> <span>Net Meeting</span></a> </div> <div class="top-menu-item articles"> <a href="https://www.tutorix.com/" rel="nofollow" target="_blank" title="Tutorx - The Best Learning App"><i class="fal fa-video"></i> <span>Tutorix</span></a> </div> <div class="top-menu-item qa login"> <a href="https://www.tutorialspoint.com/videotutorials/login.php" target="_blank" title="Tutorials Point - Login"><i class="fa fa-sign-in-alt"></i> <span>Login</span></a> </div> <div class="top-menu-item qa login"> <a href="https://www.tutorialspoint.com/videotutorials/subscription.php" target="_blank" title="Paid Package"><i class="fa fa-book-reader"></i> <span>Packages</span></a> </div> <div class="social-menu-item"> <a data-placement="bottom" href="https://www.facebook.com/tutorialspointindia" rel="nofollow" target="_blank" title="tutorialspoint @ Facebook"><i class="fab fa-facebook-f"></i></a> <a data-placement="bottom" href="https://www.twitter.com/tutorialspoint" rel="nofollow" target="_blank" title="tutorialspoint @ Twitter"><i class="fab fa-twitter"></i></a> <a data-placement="bottom" href="https://www.linkedin.com/company/tutorialspoint" rel="nofollow" target="_blank" title="tutorialspoint @ Linkedin"><i class="fab fa-linkedin-in"></i></a> <a data-placement="bottom" href="https://www.youtube.com/channel/UCVLbzhxVTiTLiVKeGV7WEBg" rel="nofollow" target="_blank" title="tutorialspoint YouTube"><i class="fab fa-youtube"></i></a> </div> </div> </div> <!-- Top sub-menu Ends Here --> <!-- Top main-menu Starts Here --> <div class="mui-appbar mui-container-fulid mui--appbar-line-height mui--z1" id="logo-menu"> <div class="mui-container"> <div class="left-menu"> <a href="https://www.tutorialspoint.com/index.htm" title="Tutorialspoint"> <img alt="tutorialspoint" class="tp-logo" src="./Beautiful Soup Tutorial - Tutorialspoint_files/logo.png"/> </a> <div class="mui-dropdown"> <a class="mui-btn mui-btn--primary categories" data-mui-toggle="dropdown"><i class="fa fa-th-large"></i> <span>Categories <span class="mui-caret"></span></span></a> <ul class="mui-dropdown__menu cat-menu"> <li> <ul> <li><a href="https://www.tutorialspoint.com/academic_tutorials.htm"><i class="fa fa-caret-right"></i> Academic Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/big_data_tutorials.htm"><i class="fa fa-caret-right"></i> Big Data & Analytics </a></li> <li><a href="https://www.tutorialspoint.com/computer_programming_tutorials.htm"><i class="fa fa-caret-right"></i> Computer Programming </a></li> <li><a href="https://www.tutorialspoint.com/computer_science_tutorials.htm"><i class="fa fa-caret-right"></i> Computer Science </a></li> <li><a href="https://www.tutorialspoint.com/database_tutorials.htm"><i class="fa fa-caret-right"></i> Databases </a></li> <li><a href="https://www.tutorialspoint.com/devops_tutorials.htm"><i class="fa fa-caret-right"></i> DevOps </a></li> <li><a href="https://www.tutorialspoint.com/digital_marketing_tutorials.htm"><i class="fa fa-caret-right"></i> Digital Marketing </a></li> <li><a href="https://www.tutorialspoint.com/engineering_tutorials.htm"><i class="fa fa-caret-right"></i> Engineering Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm"><i class="fa fa-caret-right"></i> Exams Syllabus </a></li> <li><a href="https://www.tutorialspoint.com/famous_monuments.htm"><i class="fa fa-caret-right"></i> Famous Monuments </a></li> <li><a href="https://www.tutorialspoint.com/gate_exams_tutorials.htm"><i class="fa fa-caret-right"></i> GATE Exams Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/latest_technologies.htm"><i class="fa fa-caret-right"></i> Latest Technologies </a></li> <li><a href="https://www.tutorialspoint.com/machine_learning_tutorials.htm"><i class="fa fa-caret-right"></i> Machine Learning </a></li> <li><a href="https://www.tutorialspoint.com/mainframe_tutorials.htm"><i class="fa fa-caret-right"></i> Mainframe Development </a></li> <li><a href="https://www.tutorialspoint.com/management_tutorials.htm"><i class="fa fa-caret-right"></i> Management Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/maths_tutorials.htm"><i class="fa fa-caret-right"></i> Mathematics Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/microsoft_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> Microsoft Technologies </a></li> <li><a href="https://www.tutorialspoint.com/misc_tutorials.htm"><i class="fa fa-caret-right"></i> Misc tutorials </a></li> <li><a href="https://www.tutorialspoint.com/mobile_development_tutorials.htm"><i class="fa fa-caret-right"></i> Mobile Development </a></li> <li><a href="https://www.tutorialspoint.com/java_technology_tutorials.htm"><i class="fa fa-caret-right"></i> Java Technologies </a></li> <li><a href="https://www.tutorialspoint.com/python_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> Python Technologies </a></li> <li><a href="https://www.tutorialspoint.com/sap_tutorials.htm"><i class="fa fa-caret-right"></i> SAP Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/scripting_lnaguage_tutorials.htm"><i class="fa fa-caret-right"></i>Programming Scripts </a></li> <li><a href="https://www.tutorialspoint.com/selected_reading.htm"><i class="fa fa-caret-right"></i> Selected Reading </a></li> <li><a href="https://www.tutorialspoint.com/software_quality_tutorials.htm"><i class="fa fa-caret-right"></i> Software Quality </a></li> <li><a href="https://www.tutorialspoint.com/soft_skill_tutorials.htm"><i class="fa fa-caret-right"></i> Soft Skills </a></li> <li><a href="https://www.tutorialspoint.com/telecom_tutorials.htm"><i class="fa fa-caret-right"></i> Telecom Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm"><i class="fa fa-caret-right"></i> UPSC IAS Exams </a></li> <li><a href="https://www.tutorialspoint.com/web_development_tutorials.htm"><i class="fa fa-caret-right"></i> Web Development </a></li> <li><a href="https://www.tutorialspoint.com/sports_tutorials.htm"><i class="fa fa-caret-right"></i> Sports Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/xml_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> XML Technologies </a></li> <li><a href="https://www.tutorialspoint.com/multi_language_tutorials.htm"><i class="fa fa-caret-right"></i> Multi-Language</a></li> <li><a href="https://www.tutorialspoint.com/questions_and_answers.htm"><i class="fa fa-caret-right"></i> Interview Questions</a></li> </ul> </li> </ul> <div class="clear"></div> </div> </div> <div class="right-menu"> <div class="toc-toggle"> <a href="javascript:void(0);"><i class="fa fa-bars"></i></a> </div> <div class="mobile-search-btn"> <a href="https://www.tutorialspoint.com/index.htm"><i class="fal fa-search"></i></a> </div> <div class="search-box"> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(2).txt"></script> <div id="___gcse_0"><div class="gsc-control-cse gsc-control-cse-en"><div class="gsc-control-wrapper-cse" dir="ltr"><form accept-charset="utf-8" class="gsc-search-box gsc-search-box-tools"><table cellpadding="0" cellspacing="0" class="gsc-search-box"><tbody><tr><td class="gsc-input"><div class="gsc-input-box" id="gsc-iw-id1"><table cellpadding="0" cellspacing="0" class="gstl_50 gsc-input" id="gs_id50" style="width: 100%; padding: 0px;"><tbody><tr><td class="gsib_a" id="gs_tti50"><input autocomplete="off" class="gsc-input" dir="ltr" id="gsc-i-id1" name="search" size="10" spellcheck="false" style='width: 100%; padding: 0px; border: none; margin: 0px; height: auto; background: url("https://www.google.com/cse/static/images/1x/en/branding.png") left center no-repeat rgb(255, 255, 255); outline: none;' title="search" type="text"/></td><td class="gsib_b"><div class="gsst_b" dir="ltr" id="gs_st50"><a class="gsst_a" href="javascript:void(0)" role="button" style="display: none;" title="Clear search box"><span aria-hidden="true" class="gscb_a" id="gs_cb50">×</span></a></div></td></tr></tbody></table></div></td><td class="gsc-search-button"><button class="gsc-search-button gsc-search-button-v2"><svg height="13" viewbox="0 0 13 13" width="13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg></button></td><td class="gsc-clear-button"><div class="gsc-clear-button" title="clear results"> </div></td></tr></tbody></table></form><div class="gsc-results-wrapper-overlay"><div class="gsc-results-close-btn" tabindex="0"></div><div class="gsc-positioningWrapper"><div class="gsc-tabsAreaInvisible"><div aria-label="refinement" class="gsc-tabHeader gsc-inline-block gsc-tabhActive" role="tab">Custom Search</div><span class="gs-spacer"> </span></div></div><div class="gsc-positioningWrapper"><div class="gsc-tabsAreaInvisible"></div></div><div class="gsc-above-wrapper-area-invisible"><table cellpadding="0" cellspacing="0" class="gsc-above-wrapper-area-container"><tbody><tr><td class="gsc-result-info-container"><div class="gsc-result-info-invisible"></div></td><td class="gsc-orderby-container"><div class="gsc-orderby-invisible"><div class="gsc-orderby-label gsc-inline-block">Sort by:</div><div class="gsc-option-menu-container gsc-inline-block"><div class="gsc-selected-option-container gsc-inline-block"><div class="gsc-selected-option">Relevance</div><div class="gsc-option-selector"></div></div><div class="gsc-option-menu-invisible"><div class="gsc-option-menu-item gsc-option-menu-item-highlighted"><div class="gsc-option">Relevance</div></div><div class="gsc-option-menu-item"><div class="gsc-option">Date</div></div></div></div></div></td></tr></tbody></table></div><div class="gsc-adBlockInvisible"></div><div class="gsc-wrapper"><div class="gsc-adBlockInvisible"></div><div class="gsc-resultsbox-invisible"><div class="gsc-resultsRoot gsc-tabData gsc-tabdActive"><div><div class="gsc-expansionArea"></div></div></div></div></div></div><div class="gsc-modal-background-image" tabindex="0"></div></div></div></div> </div> <div class="menu-btn library-btn"> <a href="https://www.tutorialspoint.com/tutorialslibrary.htm"><i class="fal fa-cubes"></i> <span>Library</span></a> </div> <div class="menu-btn videos-btn"> <a href="https://www.tutorialspoint.com/videotutorials/index.php"><i class="fal fa-video"></i> <span>Videos</span></a> </div> <div class="menu-btn videos-btn"> <a href="https://www.tutorialspoint.com/questions/index.php"><i class="fa fa-location-arrow"></i> <span>Q/A</span></a> </div> <div class="menu-btn ebooks-btn"> <a href="https://store.tutorialspoint.com/"><i class="fal fa-book"></i> <span>eBooks</span></a> </div> <div class="mui-dropdown"> <button class="mui-btn mui-btn--primary mobile-menu" data-mui-toggle="dropdown" type="button"> <span class="mui-caret"></span> </button> <ul class="mui-dropdown__menu"> <li class="login"><a href="https://www.tutorialspoint.com/videotutorials/login.php"><i class="fal fa-sign-in-alt"></i> <span>Login</span></a></li> <li><a href="https://www.tutorialspoint.com/tutorialslibrary.htm"><i class="fal fa-cubes"></i> <span>Library</span></a></li> <li><a href="https://www.tutorialspoint.com/videotutorials/index.php"><i class="fal fa-video"></i> <span>Videos</span></a></li> <li><a href="https://store.tutorialspoint.com/"><i class="fal fa-book"></i> <span>eBooks</span></a></li> </ul> </div> </div> </div> </div> <!-- Top main-menu Ends Here --> </header>
print(soup.body.p)
<p>In this tutorial, we will show you, how to perform web scraping in Python using Beautiful Soup 4 for getting data out of HTML, XML and other markup languages. In this we will try to scrap webpage from various different websites (including IMDB). We will cover beautiful soup 4, python basic tools for efficiently and clearly navigating, searching and parsing HTML web page. We have tried to cover almost all the functionalities of Beautiful Soup 4 in this tutorial. You can combine multiple functionalities introduced in this tutorial into one bigger program to capture multiple meaningful data from the website into some other sub-program as input.</p>
# Kinds of Objects
tag = soup.html
type(tag)
bs4.element.Tag
## Name (tag.name)
tag.name
'html'
tag.name = 'Strong'
tag
<Strong lang="en-US"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/publishertag.prebid.js.download" type="text/javascript"></script><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/osd.js.download"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/bbplayer.js.download" type="text/javascript"></script><script type="text/javascript">!function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function e(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var _=function(){return(_=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var i=(o.prototype.isAdBlocked=function(e){var t=this;this.createPixel(o.allowedPixelUrl,function(){(t.allowedPixelLoaded=!0)===t.blockedPixelFailed&&e(!0)},function(){}),this.createPixel(o.blockedPixelUrl,function(){e(!1)},function(){(t.blockedPixelFailed=!0)===t.allowedPixelLoaded&&e(!0)})},o.prototype.createPixel=function(e,t,i){var n=document.createElement("img");n.src=e,n.height=1,n.width=1,n.style.display="none",n.onload=t,n.onerror=i},o.allowedPixelUrl="https://static.criteo.net/images/pixel.gif?ch=1",o.blockedPixelUrl="https://static.criteo.net/images/pixel.gif?ch=2",o);function o(){this.allowedPixelLoaded=!1,this.blockedPixelFailed=!1}var S=(t.create=function(e){return new t(e)},t.prototype.adBlockFlagEnabled=function(){var e=t.ADBLOCK_FLAG_KEY;return null!==this.localStorageHelper.getItem(e)},t.prototype.enableAdBlockFlag=function(){var e=t.ADBLOCK_FLAG_KEY;this.localStorageHelper.setItem(e,"1",t.ADBLOCK_FLAG_LIFETIME)},t.prototype.disableAdBlockFlag=function(){var e=t.ADBLOCK_FLAG_KEY;this.localStorageHelper.removeItem(e)},t.prototype.setAdBlockFlagTimer=function(e){var t=this;this.adBlockFlagEnabled()||!this.timerEnabled||this.timerStarted||(this.timerStarted=!0,setTimeout(function(){t.timerEnabled&&(t.refreshAdblockFlag(),t.timerEnabled=!1)},e))},t.prototype.disableAdBlockFlagTimer=function(){this.timerEnabled=!1,this.adBlockFlagEnabled()&&this.refreshAdblockFlag()},t.prototype.refreshAdblockFlag=function(){var t=this;(new i).isAdBlocked(function(e){e?t.enableAdBlockFlag():t.disableAdBlockFlag()})},t.ADBLOCK_FLAG_KEY="criteo_adblock_flag",t.ADBLOCK_FLAG_LIFETIME=864e5,t);function t(e){this.timerEnabled=!0,this.timerStarted=!1,this.localStorageHelper=e}function r(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var s,u,a,R=(e(d,s=function(){}),d.prototype.ResizeFrame=function(e,t){if(this.document.defaultView&&this.document.defaultView.frameElement){var i=this.document.defaultView.frameElement;i.width=e.toString(),i.height=t.toString()}},d.prototype.Write=function(e){this.document.open(),this.document.write(e),this.document.close()},d.prototype.LoadScript=function(e){this.Write("<script type='text/javascript' src='"+r(e)+"'><\/script>")},d);function d(e){var t=s.call(this)||this;return t.document=e,t}(a=u=u||{})[a.Error=0]="Error",a[a.Warning=1]="Warning",a[a.Debug=2]="Debug";var c=["color: #fff;","background: #ff8f1c;","display: inline-block;","padding: 1px 4px;","border-radius: 3px;"].join(" "),M=(l.Log=function(e,t){if(!(l.LOGLEVEL<e)){var i=u[e].toUpperCase(),n=window.navigator.userAgent,o=0<n.indexOf("MSIE ")||0<n.indexOf("Trident/");window.console&&(o?console.log("[PubTag] "+i+": "+t):console.log("%cPubTag",c,i+": "+t))}},l.Debug=function(e){l.Log(u.Debug,e)},l.Warning=function(e){l.Log(u.Warning,e)},l.Error=function(e){l.Log(u.Error,e)},l.LOGLEVEL=u.Error,l);function l(){}var T=(p.prototype.filterNoBidSlots=function(e){var t=this.bidManager.filterNoBidSlots(e);return this.context.shouldIgnoreSilentMode?(t.length!==e.length&&this.context.setSilentModeIgnored&&this.context.setSilentModeIgnored(),e):t},p.prototype.silentModeEnabled=function(){var e=!1;return this.silentModeManager.silentModeEnabled()&&(this.context.shouldIgnoreSilentMode&&this.context.setSilentModeIgnored?this.context.setSilentModeIgnored():e=!0),e},p.prototype.getCachedBids=function(e){return this.bidManager.getRequestCachedBids(e)},p.prototype.removeBid=function(e){this.bidManager.removeBid(e)},p.prototype.handleResponse=function(e,t,i,n){var o=i.time_to_next_call;0<o&&(M.Debug("Global silent mode enabled for "+o+" seconds"),this.silentModeManager.enableSilentMode(1e3*o));var r={};if(i.slots)for(var s=0,a=i.slots;s<a.length;s++)(f=a[s]).ttl&&(r[f.imp_id]=f.ttl);var d=[];if(t.slots)for(var c=0,l=t.slots;c<l.length;c++){var u=0;(f=l[c]).slotid in r&&(u=r[f.slotid],delete r[f.slotid]),0<u&&(M.Debug("Bid for slot '"+f.impid+"' cached for "+u+" seconds"),d.push({slot:f,ttl:u}))}this.bidManager.storeResponseBids(d);var p=[];for(var h in r)if(r.hasOwnProperty(h))for(var v=0,g=e;v<g.length;v++){var f;(f=g[v]).slotId===h&&(u=r[h],M.Debug("Silent mode for slot '"+f.impId+"' enabled for "+u+" seconds"),p.push({slot:f,ttl:u}))}this.bidManager.storeRequestNoBids(p)},p.prototype.clearExpiredItems=function(){var e=this;setTimeout(function(){e.bidManager.clearExpiredItems()},3e3)},p);function p(e,t,i){this.silentModeManager=e,this.bidManager=t,this.context=i}var h=(v.prototype.eval=function(e){},v);function v(e){this.name=e}var g,f=(e(m,g=h),m.prototype.eval=function(e){this.callback&&this.callback.apply(this)},m.NAME="genericEvent",m);function m(e){var t=g.call(this,m.NAME)||this;return t.callback=e,t}var y=(C.prototype.generateRandomId=function(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,6)},C);function C(e,t,i,n,o,r,s){this.id=this.generateRandomId(),this.slotId=e,this.impressionId=t,this.cpm=i,this.width=n,this.height=o,this.zoneId=r,this.dealCode=s}var E,P=(e(w,E=y),w.prototype.GenerateEvent=function(e){var t=this;return e.ResizeFrame(this.width,this.height),new f(function(){return e.LoadScript(t.displayUrl)})},w.prototype.GenerateMessage=function(){return{displayUrl:this.displayUrl}},w);function w(e,t,i,n,o,r,s,a){var d=E.call(this,e,t,i,n,o,r,a)||this;return d.displayUrl=s,d}var b,x=(e(I,b=y),I.prototype.GenerateEvent=function(e){var t=this;return e.ResizeFrame(this.width,this.height),new f(function(){return e.Write(t.creative)})},I.prototype.GenerateMessage=function(){return{creative:this.creative}},I);function I(e,t,i,n,o,r,s,a){var d=b.call(this,e,t,i,n,o,r,a)||this;return d.creative=s,d}var A,D=(e(O,A=y),O.prototype.GenerateEvent=function(e){var t=this;return"function"!=typeof this.nativeCallback?(M.Error("'nativeCallback' parameter is not a function in placements object"),new f(void 0)):"object"!=typeof this.nativePayload?(M.Error("'nativePayload' parameter is not an object in placements object"),new f(void 0)):new f(function(){return t.nativeCallback(t.nativePayload)})},O.prototype.GenerateMessage=function(){return{nativePayload:this.nativePayload}},O);function O(e,t,i,n,o,r,s,a,d){var c=A.call(this,e,t,i,n,o,r,d)||this;return c.nativeCallback=s,c.nativePayload=a,c}var k=(B.prototype.getMetricsManager=function(){return this.metricsManager},B.prototype.withElapsed=function(e){return this.elapsed=Math.round(e),this},B.prototype.withIsTimeout=function(e){return(this.isTimeout=e)&&this.events.push({eventId:"CdbCallTimeout"}),this},B.prototype.withAdapterStartElapsed=function(e){return this.adapterStartElapsed=Math.round(e),this.events.push({eventId:"AdapterBidStart",elapsed:this.adapterStartElapsed}),this},B.prototype.withCdbCallStartElapsed=function(e){return this.cdbCallStartElapsed=Math.round(e),this.events.push({eventId:"CdbCallStart",elapsed:this.cdbCallStartElapsed}),this},B.prototype.withCdbCallEndElapsed=function(e){return this.cdbCallEndElapsed=Math.round(e),this.events.push({eventId:"CdbCallEnd",elapsed:this.cdbCallEndElapsed}),this},B.prototype.withAdapterEndElapsed=function(e){return this.adapterEndElapsed=Math.round(e),this.events.push({eventId:"AdapterBidEnd",elapsed:this.adapterEndElapsed}),this},B.prototype.withAdapterTimeout=function(e){return this.adapterTimeout=e&&Math.round(e),this},B.prototype.withSlotIdsMatchedByCache=function(e){return 0<(this.slotIdsMatchedByCache=e).length&&this.events.push({eventId:"CachedBidUsed",slots:this.slotIdsMatchedByCache}),this},B.prototype.withTimeToFirstByte=function(e){return this.timeToFirstByte=e&&Math.round(e),this.timeToFirstByte&&this.events.push({eventId:"TimeToFirstByte",elapsed:this.timeToFirstByte}),this},B.prototype.withConnectionEstablishmentTime=function(e){return this.connectionEstablishmentTime=e&&Math.round(e),this.connectionEstablishmentTime&&this.events.push({eventId:"TcpConnectionElapsedTime",elapsed:this.connectionEstablishmentTime}),this},B.prototype.withDomainLookupTime=function(e){return this.domainLookupTime=e&&Math.round(e),this.domainLookupTime&&this.events.push({eventId:"DomainLookupElapsedTime",elapsed:this.domainLookupTime}),this},B.prototype.withUserPreviousTimestamp=function(e){return e&&this.events.push({eventId:"UserReturnTime",elapsed:(new Date).getTime()-e}),this},B.prototype.buildEvents=function(e){if(this.events.length){var t={requestId:e,events:this.events};return void 0!==this.adapterTimeout&&this.adapterEndElapsed>this.adapterTimeout&&t.events.push({eventId:"AdapterTimeout"}),t}},B.prototype.clear=function(){this.events=[]},B);function B(e){this.elapsed=0,this.isTimeout=!1,this.adapterStartElapsed=0,this.cdbCallStartElapsed=0,this.cdbCallEndElapsed=0,this.adapterEndElapsed=0,this.slotIdsMatchedByCache=[],this.events=[],this.metricsManager=e}function F(e){try{return JSON.parse(e)}catch(e){return}}var U,N,L=(H.generateCacheBuster=function(){return Math.floor(99999999999*Math.random())},H);function H(){}function q(e){switch(e.toLowerCase()){case"amp":return U.AMP;default:return U.Unspecified}}(N=U=U||{})[N.Unspecified=0]="Unspecified",N[N.AMP=1]="AMP";var W=106,K=(z.prototype.buildUrl=function(e,t,i,n,o){void 0===i&&(i=U.Unspecified);var r=z.CRITEO_BIDDER_URL+this.getHandlerPath();return r+="?ptv="+W,!0===t.isAdBlocked&&(r+="&abp=1"),r=this.appendCommonParameters(r,e,n,o),r+=t.ctoIdOnPublisherDomain?"&idcpy="+t.ctoIdOnPublisherDomain:"",r+=t.secureId?"&sid="+t.secureId:"",r+=t.isOptOut?"&optout=1":"",r+=t.bundle?"&bundle="+t.bundle:"",i!==U.Unspecified&&(r+="&im="+i),r+=t.silentModeIgnored?"&smi=1":"",r+="&cb="+String(L.generateCacheBuster()),r+=t.getContextFlags()},z.prototype.buildErrorUrl=function(){return z.CRITEO_BIDDER_URL+z.CRITEO_ERROR_HANDLER},z.prototype.buildCsmEventsUrl=function(){return z.CRITEO_BIDDER_URL+z.CRITEO_CSM_EVENTS_HANDLER},z.prototype.buildCsmCountersUrl=function(){return z.CRITEO_BIDDER_URL+z.CRITEO_CSM_COUNTERS_HANDLER},z.prototype.appendCommonParameters=function(e,t,i,n){return e+="&profileId="+String(t),void 0!==i&&(e+="&av="+String(i)),void 0!==n&&(e+="&wv="+encodeURIComponent(n)),e},z.prototype.getHandlerPath=function(){return this.auditMode?z.CRITEO_BIDDER_AUDIT_HANDLER:z.CRITEO_BIDDER_HANDLER},z.CRITEO_BIDDER_URL="https://bidder.criteo.com/",z.CRITEO_BIDDER_HANDLER="cdb",z.CRITEO_CSM_HANDLER="csm",z.CRITEO_CSM_EVENTS_HANDLER="csm/events",z.CRITEO_CSM_COUNTERS_HANDLER="csm/counters",z.CRITEO_ERROR_HANDLER="error",z.CRITEO_BIDDER_AUDIT_HANDLER="prebid/audit",z);function z(e){void 0===e&&(e=!1),this.auditMode=e}var G=(V.prototype.sendEventsToBeacon=function(e,t){navigator.sendBeacon&&e&&navigator.sendBeacon(t,JSON.stringify(e))},V);function V(){this.urlBuilder=new K}var Y,j=(e(J,Y=G),J.prototype.getManagerMetrics=function(){var e=this.localStorageHelper.getItem(J.MANAGER_METRICS_STORAGE_KEY);if(null==e)return{};var t=F(e);return void 0===t?{}:t},J.prototype.setManagerMetrics=function(e){this.localStorageHelper.setItem(J.MANAGER_METRICS_STORAGE_KEY,JSON.stringify(e))},J.prototype.getSilentModeRequestCount=function(e){void 0===e&&(e=!1);var t=this.getManagerMetrics().silentModeRequestCount;return e&&this.resetSilentModeRequestCount(),isNaN(t)?0:t},J.prototype.incSilentModeRequestCount=function(){var e=this.getManagerMetrics();e.silentModeRequestCount=isNaN(e.silentModeRequestCount)?1:e.silentModeRequestCount+1,this.setManagerMetrics(e)},J.prototype.resetSilentModeRequestCount=function(){var e=this.getManagerMetrics();e.silentModeRequestCount=0,this.setManagerMetrics(e)},J.prototype.getLocalStorageKeyCount=function(){return this.localStorageHelper.getAllItemsByPrefix("criteo_").length+this.localStorageHelper.getAllItemsByPrefix("cto_").length},J.prototype.getPreviousBuildRequestTimestamp=function(){var e=this.getManagerMetrics().previousBuildRequestTimestamp;return isNaN(e)?void 0:e},J.prototype.resetPreviousBuildRequestTimestamp=function(){var e=this.getManagerMetrics();e.previousBuildRequestTimestamp=(new Date).getTime().toString(),this.setManagerMetrics(e)},J.prototype.sendEvents=function(e,t,i){void 0===i&&(i=!1),i&&(e.withUserPreviousTimestamp(this.getPreviousBuildRequestTimestamp()),this.resetPreviousBuildRequestTimestamp()),this.sendEventsToBeacon(e.buildEvents(t),this.urlBuilder.buildCsmEventsUrl()),e.clear()},J.MANAGER_METRICS_STORAGE_KEY="criteo_pt_cdb_mngr_metrics",J);function J(e){var t=Y.call(this)||this;return t.localStorageHelper=e,t}var X=(Z.tryInsertPlaceholder=function(e,t,i){var n=document.getElementById(e);if(null===n)return M.Warning("Unable to insert ad placeholder : impression id "+e+" not found."),!1;if(n.appendChild(this.createPlaceholder()),!t&&this.isVisible(n))return!0;this.removePlaceholder(e,i);var o=n.parentElement;if(null===o)return!1;var r=this.createClone(n);return o.insertBefore(r,n),r.appendChild(this.createPlaceholder()),this.isVisible(r)?(i[e]=r,!0):(M.Warning("Ad placeholder created but not visible : can't render."),o.removeChild(r),!1)},Z.isVisible=function(e){return 0!==e.offsetWidth&&0!==e.offsetHeight&&0!==e.getClientRects().length},Z.createClone=function(e){var t=e.cloneNode(!1);return t.id=this.generateRandomId(),t.className="","none"===t.style.display&&t.style.removeProperty("display"),"SPAN"===t.tagName&&(t.style.display="block"),e.style.display="none",t},Z.generateRandomId=function(){for(var e="1234567890abcdefghijklmnopqrstuvwxyz",t="",i=0;i<20;i++){var n=Math.floor(Math.random()*e.length);t+=e.charAt(n)}return t},Z.createPlaceholder=function(){var e=document.createElement("div");return e.style.width="1px",e.style.height="1px",e.style.display="block",e.className=Z.PLACEHOLDER_NAME,e},Z.removePlaceholder=function(e,t){var i=t[e];void 0!==i&&null!==i.parentNode&&i.parentNode.removeChild(i);var n=document.getElementById(e);if(null!==n)for(var o=0,r=n.getElementsByClassName(Z.PLACEHOLDER_NAME);o<r.length;o++){var s=r[o];null!==s.parentNode&&s.parentNode.removeChild(s)}},Z.insertAdIFrame=function(e,t){var i,n=t[e];if(void 0!==n)i=n;else{var o=document.getElementById(e);if(null===o)return null;i=o}for(var r=0,s=i.getElementsByClassName(Z.PLACEHOLDER_NAME);r<s.length;r++){for(var a=s[r],d=0,c=a.childNodes;d<c.length;d++){var l=c[d];null!==l.parentNode&&l.parentNode.removeChild(l)}var u=this.createAdIFrame();return a.appendChild(u),a.style.width="",a.style.height="",a.style.display="",u}return null},Z.createAdIFrame=function(){var e=document.createElement("iframe");return e.scrolling="no",e.marginWidth="0",e.marginHeight="0",e.frameBorder="0",e.style.border="0",e.style.verticalAlign="bottom",e},Z.removePlaceholders=function(e,t,i){for(var n=0,o=e;n<o.length;n++){var r=o[n].impId;-1===t.indexOf(r)&&Z.removePlaceholder(r,i)}},Z.tryInsertPlaceholders=function(e,t,i){for(var n=[],o=0,r=e;o<r.length;o++){var s=r[o],a=s.impId;Z.tryInsertPlaceholder(a,t,i)&&n.push(s)}return n},Z.PLACEHOLDER_NAME="criteo_placeholder",Z);function Z(){}var Q=($.prototype.isValid=function(){return 0<this.slots.length},$.prototype.getRequest=function(){for(var e=[],t=0,i=this.slots;t<i.length;t++){var n=i[t],o={slotid:n.slotId,impid:n.impId};if(void 0!==n.zoneId&&(o.zoneid=n.zoneId),void 0!==n.nativeCallback&&(o.native=!0),void 0!==n.transactionId&&(o.transactionid=n.transactionId),void 0!==n.publisherSubId&&(o.publishersubid=n.publisherSubId),void 0!==n.sizes){for(var r=[],s=0,a=n.sizes;s<a.length;s++){var d=a[s];r.push(d.width+"x"+d.height)}o.sizes=r}if(void 0!==n.video){var c={playersizes:this.parsePlayerSizes(n.video.playersize),mimes:n.video.mimes,protocols:n.video.protocols,maxduration:n.video.maxduration,api:n.video.api,skip:n.video.skip,placement:n.video.placement,playbackmethod:n.video.playbackmethod,minduration:n.video.minduration,startdelay:n.video.startdelay};o.video=c}if(void 0!==this.viewportComputer){var l=this.viewportComputer.getSlotPosition(n);void 0!==l&&(o.position={top:l.top,left:l.left})}void 0!==n.ext&&(o.ext=n.ext),e.push(o)}var u={ceh:this.context.ceh,uspOptout:this.context.ccpaOptout,ext:this.context.getUserExtWithContextualData()},p={publisher:{url:this.context.highestAccessibleUrl,ext:this.context.getPublisherExt()},slots:e,user:u};if(void 0!==this.networkId&&(p.publisher.networkid=this.networkId),this.privacyWrapper&&(this.privacyWrapper.gdprConsent&&(p.gdprConsent=this.privacyWrapper.gdprConsent),this.privacyWrapper.ccpaIabConsent&&(u.uspIab=this.privacyWrapper.ccpaIabConsent.uspString)),void 0!==this.viewportComputer){var h=this.viewportComputer.getViewport();p.viewport={width:h.width,height:h.height,scrollTop:h.scrollTop,scrollLeft:h.scrollLeft}}return void 0!==this.adapterTimeout&&(p.tmax=this.adapterTimeout),void 0!==this.auctionStart&&(p.auctionStart=this.auctionStart),void 0!==this.clientRequestId&&(p.id=this.clientRequestId),void 0!==this.userIds&&(p.eids=this.userIds),p},$.parsePlayerSize=function(e){return e[0]+"x"+e[1]},$.prototype.parsePlayerSizes=function(e){return Array.isArray(e[0])?e.map(function(e){return $.parsePlayerSize(e)}):[$.parsePlayerSize(e)]},$.prototype.getUrl=function(){return this.urlBuilder.buildUrl(this.profileId,this.context,this.integrationMode,this.adapterVersion,this.wrapperVersion)},$);function $(e,t,i,n,o,r,s,a,d,c,l,u,p,h){this.slots=e,this.context=t,this.urlBuilder=i,this.profileId=n,this.integrationMode=o||U.Unspecified,this.networkId=r,this.adapterVersion=s,this.privacyWrapper=a,this.wrapperVersion=d,this.viewportComputer=c,this.adapterTimeout=l,this.clientRequestId=u,this.userIds=p,this.auctionStart=h}function ee(e){var t={slots:void 0,time_to_next_call:0};return void 0!==e.exd&&(void 0!==e.exd.time_to_next_call&&(t.time_to_next_call=e.exd.time_to_next_call),t.slots=e.exd.slots,delete e.exd),t}function te(){var i=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?t:3&t|8).toString(16)})}var ie=function(e,t,i,n,o,r,s,a,d){this.slotId=te().replace(/-/g,""),this.impId=e,this.zoneId=t,this.nativeCallback=i,this.transactionId=n,this.sizes=o,this.publisherSubId=r,this.mediaTypes=s,this.video=a,this.ext=d},ne=function(e,t,i,n,o,r,s,a,d,c){this.playersize=e,this.mimes=t,this.protocols=i,this.maxduration=n,this.api=o,this.skip=r,this.placement=s,this.playbackmethod=a,this.minduration=d,this.startdelay=c},oe=(re.CreateRunning=function(){var e=new re;return e.start(),e},re.CreateWithStartTime=function(e){var t=new re(!1);return t.startTime=e,t},re.TimeSincePageLoad=function(){if(window.performance){if(window.performance.now)return window.performance.now();if(window.performance.timing&&window.performance.timing.navigationStart)return(new Date).getTime()-performance.timing.navigationStart}return 0},re.prototype.start=function(){this.startTime=this.now()},re.prototype.elapsed=function(){return this.now()-this.startTime},re);function re(e){void 0===e&&(e=!0),e&&window.performance&&window.performance.now?this.now=window.performance.now.bind(window.performance):Date.now?this.now=Date.now:this.now=function(){return(new Date).getTime()}}var se=(ae.prototype.sendRequest=function(e){this.url=e,this.sendTime=oe.CreateRunning(),this.builder.withCdbCallStartElapsed(this.timer.elapsed())},ae.prototype.requestReceived=function(e){void 0===e&&(e=!1),this.builder.withElapsed(function(e){if(window.performance&&window.performance.getEntries)for(var t=window.performance.getEntries(),i=t.length-1;0<=i;--i){var n=t[i];if(n.name===e&&n.duration)return Math.round(n.duration)}}(this.url)||this.sendTime.elapsed()),this.builder.withCdbCallEndElapsed(this.timer.elapsed()),this.builder.withIsTimeout(e)},ae.prototype.finish=function(){this.builder.withAdapterEndElapsed(this.timer.elapsed());var e=ae.getLastCdbTiming();void 0!==e&&(this.builder.withTimeToFirstByte(ae.computeTimeToFirstByte(e)),this.builder.withConnectionEstablishmentTime(ae.computeConnectionEstablishmentTime(e)),this.builder.withDomainLookupTime(ae.computeDomainLookupTime(e)))},ae.getLastCdbTiming=function(){if(void 0!==window.performance&&void 0!==window.performance.getEntriesByType&&"function"==typeof window.performance.getEntriesByType){var e=window.performance.getEntriesByType("resource");if(void 0!==e){var t=e.filter(function(e){return 0<=e.name.indexOf("cdb")});return void 0!==t&&0<t.length?t[t.length-1]:void 0}}},ae.computeTimeToFirstByte=function(e){var t=e.responseStart,i=e.requestStart;if(void 0!==t&&void 0!==i)return t-i},ae.computeConnectionEstablishmentTime=function(e){var t=e.connectEnd-e.connectStart;return isNaN(t)?void 0:t},ae.computeDomainLookupTime=function(e){var t=e.domainLookupEnd-e.domainLookupStart;return isNaN(t)?void 0:t},ae);function ae(e,t,i){this.builder=e,this.timer=void 0!==t?oe.CreateWithStartTime(t):oe.CreateRunning();var n=this.timer.elapsed();this.builder.withAdapterStartElapsed(n),void 0!==i&&this.builder.withAdapterTimeout(i)}var de=(ce.prototype.toString=function(){return this.width+"x"+this.height},ce);function ce(e,t){this.width=e,this.height=t}function le(e){var t="number"==typeof window.PREBID_TIMEOUT?window.PREBID_TIMEOUT:void 0;return e&&t?Math.min(e,t):e||t||void 0}var ue=function(e,t){this.top=e,this.left=t},pe=function(e,t,i,n){this.width=e,this.height=t,this.scrollTop=i,this.scrollLeft=n},he=(ve.getHighestAccessibleWindow=function(e){var t=e,i=!1;try{for(;t.parent.document!==t.document;){if(!t.parent.document){i=!0;break}t=t.parent}}catch(e){i=!0}return{topFrame:t,err:i}},ve.getHighestAccessibleUrl=function(e){var t=e.topFrame;if(!e.err)return t.location.href;try{var i=t.top.location.href;if(i)return i}catch(e){}try{var n=t.location.ancestorOrigins;if(n)return n[n.length-1]}catch(e){}return t.document.referrer},ve.inIframe=function(){try{return window.self!==window.top}catch(e){return!0}},ve);function ve(){}var ge=(fe.prototype.getViewport=function(){var e=he.getHighestAccessibleWindow(window).topFrame,t=e.document,i=e.innerWidth||t.documentElement.clientWidth,n=e.innerHeight||t.documentElement.clientHeight,o=t.documentElement.scrollTop||t.body&&t.body.scrollTop||0,r=t.documentElement.scrollLeft||t.body&&t.body.scrollLeft||0;return new pe(i,n,o,r)},fe.prototype.getSlotPosition=function(e){var t=e.impId,i=document.getElementById(t);if(null!==i){var n=i.getBoundingClientRect();return new ue(n.top,n.left)}},fe);function fe(){}var me=(ye.prototype.checkLocalStorage=function(e){if(!this.localStorage)return!1;var t=this.CHECK_STORAGE_KEY;try{return this.localStorage.setItem(t,t),this.localStorage.removeItem(t),!!this.checkTcfPurposeOne(e)||(M.Debug("Purpose One not granted"),!1)}catch(e){return!1}},ye.prototype.checkTcfPurposeOne=function(e){return!e||!e.purposes||!0===e.purposes[1]},ye.prototype.removeItem=function(e){this.localStorageEnabled&&(this.localStorage.removeItem(e),this.localStorage.removeItem(e+this.EXPIRE_SUFFIX))},ye.prototype.getItem=function(e,t){if(!this.localStorageEnabled)return null;var i=(new Date).getTime(),n=this.localStorage.getItem(e+this.EXPIRE_SUFFIX),o=n?parseInt(n,10):-1;return-1!==o&&o<i||t&&(-1===o||t<o-i)?(this.removeItem(e),null):this.localStorage.getItem(e)},ye.prototype.setItem=function(e,t,i){if(this.localStorageEnabled)try{if(this.localStorage.setItem(e,t),i){var n=(new Date).getTime()+i;this.localStorage.setItem(e+this.EXPIRE_SUFFIX,n.toString())}}catch(e){}},ye.prototype.getAllItemsByPrefix=function(e){var t=[];if(this.localStorageEnabled)for(var i in localStorage)0===i.indexOf(e)&&t.push(i);return t},ye);function ye(e,t){this.EXPIRE_SUFFIX="_expires",this.CHECK_STORAGE_KEY="criteo_localstorage_check",this.localStorage=function(e){try{return e.localStorage}catch(e){return}}(e||window),this.localStorageEnabled=this.checkLocalStorage(t)}var Ce=(Ee.prototype.silentModeEnabled=function(){var e=Ee.SILENT_MODE_KEY;return null!==this.localStorageHelper.getItem(e)},Ee.prototype.enableSilentMode=function(e){var t=Ee.SILENT_MODE_KEY;this.localStorageHelper.setItem(t,"1",e)},Ee.SILENT_MODE_KEY="criteo_silent_mode",Ee);function Ee(e){this.localStorageHelper=e}function we(){return(new Date).getTime()}var be=(Ie.prototype.toString=function(){return"ImpId"+this.impressionId},Ie);function Ie(e){this.impressionId=e}var _e,Se=(e(Te,_e=be),Te.prototype.toString=function(){return _e.prototype.toString.call(this)+"_Size"+this.size+"_NetworkId"+this.networkId},Te);function Te(e,t,i){var n=_e.call(this,e)||this;return n.size=t,n.networkId=i,n}var Ae,Re=(e(Me,Ae=be),Me.prototype.toString=function(){return Ae.prototype.toString.call(this)+"_ZoneId"+this.zoneId},Me);function Me(e,t){var i=Ae.call(this,e)||this;return i.zoneId=t,i}var Pe=(xe.prototype.createKeysFromSlotRequest=function(e){if(this.useZoneIdIntegration)return[new Re(e.impId,e.zoneId)];for(var t=[],i=0,n=e.sizes;i<n.length;i++){var o=n[i];t.push(new Se(e.impId,o,this.networkId))}return t},xe.prototype.createKeyFromSlotResponse=function(e){return this.useZoneIdIntegration?new Re(e.impid,e.zoneid):new Se(e.impid,new de(e.width,e.height),this.networkId)},xe.prototype.createKeyFromBid=function(e){return this.useZoneIdIntegration?new Re(e.impressionId,e.zoneId):new Se(e.impressionId,new de(e.width,e.height),this.networkId)},xe);function xe(e,t){this.useZoneIdIntegration=e,this.networkId=t}var De=(Oe.useZoneIdIntegration=function(e,t){return void 0===t||0===e.filter(function(e){return void 0!==e.sizes&&0<e.sizes.length}).length},Oe.prototype.getBySlotKey=function(e,t){var i=t.toString();if(i in e){var n=e[i];if(void 0!==n)return void 0!==n.bid&&void 0!==n.expiration&&n.expiration<we()&&(n.bid=void 0,n.expiration=void 0),n}return{}},Oe.prototype.setBySlotKey=function(e,t,i){var n=t.toString();void 0!==i.bid||void 0!==i.expiration&&i.expiration>we()?e[n]=i:n in e&&delete e[n]},Oe.prototype.filterNoBidSlots=function(e){for(var t=[],i=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),n=i&&F(i)||{},o=0,r=e;o<r.length;o++){for(var s=r[o],a=[],d=0,c=this.slotKeyFactory.createKeysFromSlotRequest(s);d<c.length;d++){var l=c[d];this.getBidFromMap(n,l,0)!==Oe.NO_BID&&(l instanceof Se?a.push(l.size):t.push(s))}0<a.length&&(s.sizes=a,t.push(s))}return t},Oe.prototype.getRequestCachedBids=function(e,t){void 0===t&&(t=5e3);for(var i={},n=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),o=n&&F(n)||{},r=0,s=e;r<s.length;r++)for(var a=s[r],d=0,c=this.slotKeyFactory.createKeysFromSlotRequest(a);d<c.length;d++){var l=c[d],u=this.getBidFromMap(o,l,t);void 0!==u&&u!==Oe.NO_BID&&(i[a.slotId]=u)}return this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(o)),i},Oe.prototype.getBid=function(e,t){void 0===t&&(t=5e3);var i=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),n=i&&F(i)||{},o=this.getBidFromMap(n,e,t);return this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(n)),o},Oe.prototype.getBidFromMap=function(e,t,i){void 0===i&&(i=5e3);var n=this.getBySlotKey(e,t);return void 0===n.bid&&n.expiration&&n.expiration>we()?Oe.NO_BID:0<i&&void 0!==n.bid?(delete e[t.toString()],n.bid):void 0},Oe.prototype.storeResponseBids=function(e){for(var t=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),n=t&&F(t)||{},i=function(i){var e=o.slotKeyFactory.createKeyFromSlotResponse(i.slot);o.modifyCache(n,e,function(e){var t=we()+1e3*i.ttl;(void 0===e.expiration||e.expiration<t)&&(e.bid=i.slot,e.expiration=t)})},o=this,r=0,s=e;r<s.length;r++)i(s[r]);this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(n))},Oe.prototype.storeRequestNoBids=function(e){for(var t=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),o=t&&F(t)||{},i=function(t){for(var e=0,i=r.slotKeyFactory.createKeysFromSlotRequest(t.slot);e<i.length;e++){var n=i[e];r.modifyCache(o,n,function(e){e.bid=void 0,e.expiration=Math.max(e.expiration||0,we()+1e3*t.ttl)})}},r=this,n=0,s=e;n<s.length;n++)i(s[n]);this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(o))},Oe.prototype.removeBid=function(t){var e=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),i=e&&F(e)||{},n=this.slotKeyFactory.createKeyFromBid(t);this.modifyCache(i,n,function(e){void 0!==e.bid&&e.bid.slotid===t.slotId&&(e.bid=void 0,e.expiration=void 0)}),this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(i))},Oe.prototype.modifyCache=function(e,t,i){var n=this.getBySlotKey(e,t);i(n),this.setBySlotKey(e,t,n)},Oe.prototype.clearExpiredItems=function(){for(var e=this.localStorageHelper.getItem(Oe.BIDCACHE_STORAGE_KEY),t=e&&F(e)||{},i=0,n=Object.keys(t);i<n.length;i++){var o=n[i],r=t[o];void 0!==r&&void 0!==r.expiration&&r.expiration<we()&&delete t[o]}this.localStorageHelper.setItem(Oe.BIDCACHE_STORAGE_KEY,JSON.stringify(t))},Oe.NO_BID="nobid",Oe.BIDCACHE_STORAGE_KEY="criteo_pt_cdb_bidcachemap",Oe);function Oe(e,t,i){this.localStorageHelper=e,this.slotKeyFactory=new Pe(t,i)}var ke=(Be.prototype.send=function(e,t,i,n){var o=void 0!==this.data?"POST":"GET",r=this.getXMLHttpRequest(o,e,t,i,n);if(void 0!==r)r.send(this.data);else{var s=this.getXDomainRequest(o,e,t,i,n);void 0!==s&&s.send(this.data)}},Be.prototype.getXMLHttpRequest=function(e,t,i,n,o){var r=new XMLHttpRequest;if("withCredentials"in r)return r.open(e,this.url,!0),r.timeout=o||Be.LOCAL_PASSBACK_TIMEOUT,this.contentType?r.setRequestHeader("Content-type",this.contentType):"POST"===e&&r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.withCredentials=this.withCredentials,r.onload=function(){4===r.readyState&&200===r.status?t(r.responseText):i(r.readyState,r.status)},r.onerror=function(){i(void 0,void 0)},n&&(r.ontimeout=n),r},Be.prototype.getXDomainRequest=function(e,t,i,n,o){if("undefined"!=typeof XDomainRequest){var r=new XDomainRequest;return r.timeout=o||Be.LOCAL_PASSBACK_TIMEOUT,r.open(e,this.url),r.onload=function(){void 0!==r.responseText?t(r.responseText):i(void 0,void 0)},r.onerror&&(r.onerror=function(){i(void 0,void 0)}),r.ontimeout&&n&&(r.ontimeout=n),r}},Be.LOCAL_PASSBACK_TIMEOUT=3e4,Be);function Be(e,t,i,n){void 0===n&&(n=!0),this.url=e,this.data=t,this.contentType=i,this.withCredentials=n}var Fe=(Ue.prototype.retrievePixels=function(e,t,i){var n=this;new ke(this.getUserSyncUrl(e,t,i)).send(function(e){if(e){var t=Ue.parseUserSyncResponse(e);t?n.onPixelsRetrieved(t):n.errorReporter.log("Error","Unable to parse response from user sync")}},function(e,t){M.Warning("User Sync Pixel endpoint error; readyState "+e+"; requestStatus "+t)},function(){M.Warning("User Sync Pixel endpoint timeout")},this.pixelSyncTimeout)},Ue.prototype.getUserSyncUrl=function(e,t,i){var n=[];return(null==e?void 0:e.consentData)&&n.push("gdpr="+e.consentData),(null==e?void 0:e.gdprApplies)&&n.push("gdprapplies="+e.gdprApplies),(null==t?void 0:t.uspString)&&n.push("ccpa="+t.uspString),(null==i?void 0:i.country_code)&&n.push("countrycode="+i.country_code),this.debug&&n.push("debug=1"),this.pixelSyncEndpoint+(n.length?"?"+n.join("&"):"")},Ue.parseUserSyncResponse=function(e){var t=F(e);return t?("pixels"in t?Array.isArray(t.pixels)?t.pixels=t.pixels.filter(function(t){try{return new URL(t),!0}catch(e){return M.Warning("Failed to parse User Sync Pixel URL: "+t),!1}}):(M.Warning("pixels field in user sync response is not an array: "+t.pixels),t.pixels=[]):t.pixels=[],t):void M.Warning("Failed to parse user sync pixel JSON payload")},Ue);function Ue(e,t,i){void 0===i&&(i=!1),this.pixelSyncEndpoint="https://3pd.criteo.com/user-sync/pixels",this.pixelSyncTimeout=2e3,this.errorReporter=t,this.onPixelsRetrieved=e,this.debug=i}var Ne=(Le.execUserSync=function(e,t,i,n,o){void 0===o&&(o=!1),new Fe(Le.appendUserSyncPixels,e,o).retrievePixels(t,i,n)},Le.getOrCreateTagContainer=function(){var e=document.getElementById(Le.tagElementName);if(e)return e;var t=document.createElement("div");return t.setAttribute("id",Le.tagElementName),t.style.display="none",document.body.appendChild(t),t},Le.appendUserSyncPixels=function(e){if(e.pixels.length)for(var t=Le.getOrCreateTagContainer(),i=0,n=e.pixels;i<n.length;i++){var o=n[i],r=new Image;r.src=o,t.appendChild(r)}},Le.tagElementName="criteoUserSyncTagsContainer",Le);function Le(){}var He,qe;(qe=He=He||{}).Native="native",qe.Banner="banner",qe.Video="video";var We=(Ke.prototype.hasValidNativeParams=function(e){return!(e.nativeParams&&(e.nativeParams.image&&(!0!==e.nativeParams.image.sendId||!0===e.nativeParams.image.sendTargetingKeys)||e.nativeParams.icon&&(!0!==e.nativeParams.icon.sendId||!0===e.nativeParams.icon.sendTargetingKeys)||e.nativeParams.clickUrl&&(!0!==e.nativeParams.clickUrl.sendId||!0===e.nativeParams.clickUrl.sendTargetingKeys)||e.nativeParams.displayUrl&&(!0!==e.nativeParams.displayUrl.sendId||!0===e.nativeParams.displayUrl.sendTargetingKeys)||e.nativeParams.privacyLink&&(!0!==e.nativeParams.privacyLink.sendId||!0===e.nativeParams.privacyLink.sendTargetingKeys)||e.nativeParams.privacyIcon&&(!0!==e.nativeParams.privacyIcon.sendId||!0===e.nativeParams.privacyIcon.sendTargetingKeys)))},Ke.prototype.buildCdbUrl=function(){return this.url},Ke.prototype.buildCdbRequest=function(){if(this.cache.silentModeEnabled())return M.Debug("Request ignored because the global silent mode is enabled"),void this.metricsManager.incSilentModeRequestCount();if(this.requestBuilder.isValid()){var e=Math.min((this.timeout||5e3)+1e3,5e3);return this.adBlockFlagManager.setAdBlockFlagTimer(e),this.timer.sendRequest(this.url),this.requestBuilder.getRequest()}M.Debug("Request ignored because it doesnt contain any slot")},Ke.GetAllAdapters=function(){return(window.Criteo_prebid_106||window.Criteo).prebid_adapters},Ke.GetAdapter=function(e){var t="string"==typeof e?e:e.bidRequests[0].auctionId,i=Ke.GetAllAdapters();if(i&&t in i)return i[t]},Ke.createCriteoNativeAdWithCallback=function(e,t,i){var n=r(e);return window.criteo_prebid_native_slots=window.criteo_prebid_native_slots||{},window.criteo_prebid_native_slots[n]={callback:i,payload:t},'<script type="text/javascript">\n var win = window;\n for (var i = 0; i < 10; ++i) {\n win = win.parent;\n if (win.criteo_prebid_native_slots) {\n var responseSlot = win.criteo_prebid_native_slots["'+n+'"];\n responseSlot.callback(responseSlot.payload);\n break;\n }\n }\n <\/script>'},Ke.createPrebidNativeAd=function(e){return{sendTargetingKeys:!1,title:e.products[0].title,body:e.products[0].description,sponsoredBy:e.advertiser.description,icon:e.advertiser.logo,image:e.products[0].image,clickUrl:e.products[0].click_url,privacyLink:e.privacy.optout_click_url,privacyIcon:e.privacy.optout_image_url,cta:e.products[0].call_to_action,price:e.products[0].price,impressionTrackers:e.impression_pixels.map(function(e){return e.url})}},Ke.prototype.getBidRequestForSlot=function(e){for(var t=0,i=this.bidRequests;t<i.length;t++){var n=i[t];if(n.adUnitCode===e.impid&&(!n.params.zoneId||parseInt(n.params.zoneId,10)===e.zoneid))return n}},Ke.prototype.getSlotForAdUnitCode=function(e){for(var t=0,i=this.slots;t<i.length;t++){var n=i[t];if(n&&n.impId===e)return n}},Ke.getVideoInfoFromBidRequest=function(e){if(Ke.hasVideoMediaType(e))return new ne(e.mediaTypes.video.playerSize,e.mediaTypes.video.mimes,e.mediaTypes.video.protocols,e.mediaTypes.video.maxduration,e.mediaTypes.video.api,e.params.video.skip,e.params.video.placement,e.params.video.playbackmethod,e.params.video.minduration,e.params.video.startdelay)},Ke.hasVideoMediaType=function(e){return void 0!==e.params&&void 0!==e.params.video&&!(void 0===e.mediaTypes||void 0===e.mediaTypes.video)},Ke.prototype.interpretResponse=function(e,t){var i=window.criteo_pubtag_prebid_106||window.criteo_pubtag;this.timer.requestReceived(),this.adBlockFlagManager.disableAdBlockFlagTimer();var n=ee(e),o={};if(void 0!==n.slots)for(var r=0,s=n.slots;r<s.length;r++)o[(w=s[r]).imp_id]=w;var a,d,c,l,u,p,h,v,g,f,m,y=[];if(e.slots&&Array.isArray(e.slots))for(var C=0,E=e.slots;C<E.length;C++){var w=E[C],b=this.getBidRequestForSlot(w);if(b)if(!0===i.context.isAdBlocked){if(void 0!==(a=w.slotid,d=w.impid,c=w.cpm,l=w.width,u=w.height,p=w.zoneid,h=b.params.nativeCallback,v=w.native,g=w.displayurl,f=w.creative,m=w.deal,A=void 0!==h&&void 0!==v?new D(a,d,c,l,u,p,h,v,m):void 0===g||void 0!==f&&"<script"!==f.substr(0,7)?void 0!==f?new x(a,d,c,l,u,p,f,m):void 0:new P(a,d,c,l,u,p,g,m))&&X.tryInsertPlaceholder(b.adUnitCode,!0,i.context.cloneByImpressionId)){var I=X.insertAdIFrame(b.adUnitCode,i.context.cloneByImpressionId);if(null!=I){var _=new R(I.contentDocument);A.GenerateEvent(_).eval(window.criteo_pubtag_prebid_106)}}}else{var S=b.bidId,T=w.ttl||o[w.slotid]&&o[w.slotid].ttl||60,A={requestId:S,adId:te(),cpm:w.cpm,currency:w.currency,netRevenue:!0,ttl:T,creativeId:S,width:w.width,height:w.height,dealId:w.deal};w.native?b.params.nativeCallback?A.ad=Ke.createCriteoNativeAdWithCallback(S,w.native,b.params.nativeCallback):(A.native=Ke.createPrebidNativeAd(w.native),A.mediaType=He.Native):w.video?(A.vastUrl=w.displayurl,A.mediaType=He.Video):A.ad=w.creative,y.push(A)}else M.Error("Unable to bid request for slot "+w)}return this.cache.handleResponse(this.slots,e,n,!1),this.timer.finish(),this.metricsManager.sendEvents(this.metricBuilder,this.clientRequestId,!0),this.cache.clearExpiredItems(),!0===e.user_sync&&Ne.execUserSync(i.context.remoteLogging,this.gdprConsent,this.ccpaIabConsent,e),y},Ke.prototype.handleBidWon=function(){},Ke.prototype.handleBidTimeout=function(){this.timer.requestReceived(!0),this.timer.finish(),this.metricsManager.sendEvents(this.metricBuilder,this.clientRequestId,!0),this.cache.clearExpiredItems()},Ke.prototype.handleSetTargeting=function(){},Ke.prototype.getBannerSizes=function(e){var t,i;return(null===(i=null===(t=e.mediaTypes)||void 0===t?void 0:t.banner)||void 0===i?void 0:i.sizes)||e.sizes||[]},Ke.prototype.getNativeSizes=function(e){var t,i,n;return(null===(n=null===(i=null===(t=e.mediaTypes)||void 0===t?void 0:t.native)||void 0===i?void 0:i.image)||void 0===n?void 0:n.sizes)||[]},Ke.prototype.getSizes=function(e){var t,i=this.getBannerSizes(e).map(function(e){return new de(e[0],e[1])}),n=this.getNativeSizes(e).map(function(e){return new de(e[0],e[1])}),o=i.concat(n);return(null===(t=e.mediaTypes)||void 0===t?void 0:t.native)&&(0===o.length?o=[new de(2,2)]:o.forEach(function(e,t,i){void 0===e.height&&void 0===e.width&&(i[t]=new de(2,2))})),o.filter(function(e,t,i){return i.indexOf(e)===t})},Ke.prototype.getFloorsForSizes=function(e,o,r){var s={},t=r.getFloor({currency:"USD",size:"*",mediaType:o});if("USD"!==t.currency)throw new Error("Currency for floors is not in USD, or cannot be converted to USD");return s["*"]=t.floor,e.forEach(function(e,t,i){var n=new de(e[0],e[1]);s[n.toString()]=r.getFloor({currency:"USD",size:e,mediaType:o}).floor}),s},Ke);function Ke(e,t,i,n,o){var r,s,a,d=window.criteo_pubtag_prebid_106||window.criteo_pubtag;this.clientRequestId=te(),this.gdprConsent={},n.gdprConsent&&(void 0!==n.gdprConsent.consentString&&(this.gdprConsent.consentData=n.gdprConsent.consentString),void 0!==n.gdprConsent.gdprApplies&&(this.gdprConsent.gdprApplies=!!n.gdprConsent.gdprApplies),this.gdprConsent.version=n.gdprConsent.apiVersion),this.ccpaIabConsent={uspString:n.uspConsent};var c=new me(void 0,this.gdprConsent);this.timeout=le(n.timeout),this.metricsManager=new j(c),this.metricBuilder=new k(this.metricsManager),this.timer=new se(this.metricBuilder,n.start,this.timeout);var l,u,p=new ge;this.adBlockFlagManager=S.create(c),this.adBlockFlagManager.adBlockFlagEnabled()&&(e=280,d.context.isAdBlocked=!0),this.auctionId=n.auctionId,this.bidRequests=i,this.slots=[];for(var h,v=!0,g=0,f=i;g<f.length;g++){var m=void 0;(w=f[g]).fpd&&w.fpd.context&&(m=w.fpd.context),w.params.ext&&(m=_(_({},m),w.params.ext)),v=this.hasValidNativeParams(w);try{var y={};if(w.getFloor&&((null===(r=w.mediaTypes)||void 0===r?void 0:r.banner)&&(y.banner=this.getFloorsForSizes(this.getBannerSizes(w),"banner",w)),(null===(s=w.mediaTypes)||void 0===s?void 0:s.native)&&(y.native=this.getFloorsForSizes(this.getNativeSizes(w),"native",w)),null===(a=w.mediaTypes)||void 0===a?void 0:a.video)){var C=w.mediaTypes.video.playerSize||[];y.video=0<C.length&&"number"==typeof C[0]?this.getFloorsForSizes([C],"video",w):this.getFloorsForSizes(C,"video",w)}Object.keys(y).length&&(m=_(_({},m),{floors:y}))}catch(e){M.Debug("Could not parse floors from Prebid: "+e)}this.slots.push(new ie(w.adUnitCode,w.params.zoneId,w.params.nativeCallback,w.transactionId,this.getSizes(w),w.params.publisherSubId,w.mediaTypes,Ke.getVideoInfoFromBidRequest(w),m)),l=w.params.networkId||l,h=n.ceh,(window.criteo_pubtag_prebid_106||window.criteo_pubtag).context.ceh=h,w.params.integrationMode&&(u=q(w.params.integrationMode))}v||M.Warning("All native assets containing URL should be sent as placeholders with sendId(icon, image, clickUrl, privacyLink, privacyIcon)");var E,w,b=new K(!1);0<i.length&&(w=i[0]).userIdAsEids&&0<w.userIdAsEids.length&&(E=w.userIdAsEids);"function"==typeof d.context.setPublisherExt&&"function"==typeof d.context.setUserExt?(d.context.setPublisherExt(n.publisherExt),d.context.setUserExt(n.userExt)):(d.context.publisherExt=n.publisherExt,d.context.userExt=n.userExt);var I=De.useZoneIdIntegration(this.slots,l);this.cache=new T(new Ce(c),new De(c,I,l),d.context),this.requestBuilder=new Q(this.cache.filterNoBidSlots(this.slots),d.context,b,e,u,l,t,{ccpaIabConsent:this.ccpaIabConsent,gdprConsent:this.gdprConsent},o,p,this.timeout,this.clientRequestId,E,n.start),this.url=this.requestBuilder.getUrl(),(window.Criteo_prebid_106||window.Criteo).prebid_adapters=(window.Criteo_prebid_106||window.Criteo).prebid_adapters||{},(window.Criteo_prebid_106||window.Criteo).prebid_adapters[this.auctionId]=this}function ze(e){try{return JSON.parse(e)}catch(e){return}}var Ge=(Ve.prototype.getCMPFrame=function(){for(var e,t=this.currentWindow,i=0;i<10;++i){try{t.frames.__uspapiLocator&&(e=t)}catch(e){}if(t===this.currentWindow.top)break;t=t.parent}return e},Ve.prototype.hasCallerFunctionInWindow=function(){return"function"==typeof this.currentWindow.__uspapi},Ve.prototype.readyToRetrieve=function(){return this.hasCallerFunctionInWindow()||void 0!==this.getCMPFrame()},Ve.prototype.retrieveConsent=function(i){var n=this,o=!1,r=window.setTimeout(function(){o=!0,n.logger("Timeout: Unable to resolve CCPA consent after "+n.timeout+"ms"),i(void 0)},this.timeout);this.executeCommand("getUSPData",1,function(e,t){o||(clearTimeout(r),t?(n.logger("CCPA consent retrieved"),n.processResponseData(e,i)):(n.logger("Error retrieving CCPA consent data from CMP"),i(void 0)))})},Ve.prototype.processResponseData=function(e,t){e?t(e):(this.logger("Unable to read CCPA consent data from CMP"),t(void 0))},Ve.prototype.executeCommand=function(e,t,i){var r=this;if(!this.hasCallerFunctionInWindow()){this.logger("No CCPA CMP defined on current frame");var s=this.getCMPFrame();this.currentWindow.__uspapi=function(e,t,i){if(!s)return r.logger("CCPA CMP not found in any frame"),void i({msg:"CCPA CMP not found in any frame"},!1);var n=Math.random().toString(10),o={__uspapiCall:{command:e,parameter:t,callId:n}};r.uspapiCallbacks[n]=i,s.postMessage(o,"*")},this.currentWindow.addEventListener("message",function(e){var t="string"==typeof e.data?ze(e.data):e.data;if(t&&t.__uspapiReturn&&t.__uspapiReturn.callId&&t.__uspapiReturn.returnValue){var i=t.__uspapiReturn;r.uspapiCallbacks&&r.uspapiCallbacks[i.callId]&&(r.uspapiCallbacks[i.callId](i.returnValue,i.success),delete r.uspapiCallbacks[i.callId])}},!1)}this.currentWindow.__uspapi(e,t,i)},Ve.prototype.hasUserOptOut=function(e){return!(!e||!e.uspString||"1YNY"===e.uspString.toUpperCase()||"1YNN"===e.uspString.toUpperCase()||"1YN-"===e.uspString.toUpperCase()||"1-N-"===e.uspString.toUpperCase()||"1---"===e.uspString)},Ve);function Ve(e,t,i){void 0===i&&(i=function(e){}),this.uspapiCallbacks={},this.currentWindow=e,this.timeout=t.uspApiTimeout,this.logger=i}var Ye=(je.prototype.getReadyToRetrieveProvider=function(){return this.tcfv2ConsentProvider.hasCallerFunctionInFrame()?this.tcfv2ConsentProvider:this.tcfv1ConsentProvider.hasCallerFunctionInFrame()?this.tcfv1ConsentProvider:void 0!==this.tcfv2ConsentProvider.getCMPFrame()?this.tcfv2ConsentProvider:void 0!==this.tcfv1ConsentProvider.getCMPFrame()?this.tcfv1ConsentProvider:void 0},je.prototype.retrieveConsentForPassback=function(e){var t=this.getReadyToRetrieveProvider();void 0===t&&(this.logger("No compatible GDPR privacy provider found"),e(void 0)),t===this.tcfv1ConsentProvider?this.tcfv1ConsentProvider.retrieveConsentForPassback(e):t===this.tcfv2ConsentProvider&&this.tcfv2ConsentProvider.retrieveConsent(e)},je.prototype.retrieveConsent=function(e){var t=this.getReadyToRetrieveProvider();void 0===t&&(this.logger("No compatible GDPR privacy provider found"),e(void 0)),null==t||t.retrieveConsent(e)},je.prototype.readyToRetrieve=function(){return this.tcfv2ConsentProvider.readyToRetrieve()||this.tcfv1ConsentProvider.readyToRetrieve()},je);function je(e,t,i){void 0===i&&(i=function(e){}),this.tcfv1ConsentProvider=e,this.tcfv2ConsentProvider=t,this.logger=i}var Je=(Xe.prototype.getCMPFrame=function(){for(var e,t=this.currentWindow,i=0;i<10;++i){try{t.frames.__cmpLocator&&(e=t)}catch(e){}if(t===this.currentWindow.top)break;t=t.parent}return e},Xe.prototype.hasCallerFunctionInFrame=function(){return"function"==typeof this.currentWindow.__cmp},Xe.prototype.readyToRetrieve=function(){return this.hasCallerFunctionInFrame()||void 0!==this.getCMPFrame()},Xe.prototype.pingWithTimeout=function(n,e,t,i){function o(e,t){r.logger(t),clearTimeout(e),i()}var r=this;return window.setTimeout(function(){var i=window.setTimeout(function(){o(n,"Timeout: Unable to get ping return after "+e+"ms")},e);r.executeCommand("ping",null,function(e,t){clearTimeout(i),t?(r.logger("GDPR CMP ping returned"),!0!==e.cmpLoaded&&o(n,"GDPR ping returned cmpLoaded which is not true"),r.logger("GDPR ping returned cmpLoaded which is true")):o(n,"Error sending ping to GDPR CMP")})},t)},Xe.prototype.retrieveConsent=function(e){this.executeRetrieveConsent("getConsentData",null,e)},Xe.prototype.retrieveConsentForPassback=function(e){this.executeRetrieveConsent("getVendorConsents",[91],e)},Xe.prototype.executeRetrieveConsent=function(e,t,i){var n=this,o=!1,r=window.setTimeout(function(){o=!0,n.logger("Timeout: Unable to resolve GDPR consent after "+n.timeout+"ms"),i(void 0)},this.timeout),s=!1!==this.cmpAutoDetect?this.pingWithTimeout(r,this.pingTimeout,this.pingDelay,function(){o=!0,n.logger("Timeout: Unable to ping GDPR API after "+n.pingTimeout+"ms"),i(void 0)}):void 0;this.executeCommand(e,t,function(e,t){clearTimeout(s),o||(clearTimeout(r),t?(n.logger("GDPR consent retrieved"),n.processConsentData(e,i)):(n.logger("Error retrieving GDPR consent data from CMP"),i(void 0)))})},Xe.prototype.processConsentData=function(e,t){if(e){var i={};void 0!==e.consentData&&(i.consentData=e.consentData),void 0!==e.gdprApplies&&(i.gdprApplies=!!e.gdprApplies),t(i)}else this.logger("Unable to read GDPR consent data from CMP"),t(void 0)},Xe.prototype.executeCommand=function(e,t,i){var r=this;if(!this.hasCallerFunctionInFrame()){this.logger("No GDPR CMP defined on current frame");var s=this.getCMPFrame();this.currentWindow.__cmp=function(e,t,i){if(!s)return r.logger("GDPR CMP not found in any frame"),void i({msg:"GDPR CMP not found in any frame"},!1);var n=Math.random().toString(10),o={__cmpCall:{command:e,parameter:t,callId:n}};r.cmpCallbacks[n]=i,s.postMessage(o,"*")},this.currentWindow.addEventListener("message",function(e){var t="string"==typeof e.data?ze(e.data):e.data;if(t&&t.__cmpReturn&&t.__cmpReturn.callId&&t.__cmpReturn.returnValue){var i=t.__cmpReturn;r.cmpCallbacks&&r.cmpCallbacks[i.callId]&&(r.cmpCallbacks[i.callId](i.returnValue,i.success),delete r.cmpCallbacks[i.callId])}},!1)}this.currentWindow.__cmp(e,t,i)},Xe);function Xe(e,t,i){void 0===i&&(i=function(e){}),this.cmpCallbacks={},this.currentWindow=e,this.timeout=t.tcfTimeout,this.pingTimeout=t.tcfPingTimeout,this.pingDelay=t.tcfPingDelay,this.cmpAutoDetect=t.cmpAutoDetect,this.logger=i}var Ze=(Qe.prototype.getCMPFrame=function(){for(var e,t=this.currentWindow,i=0;i<10;++i){try{t.frames.__tcfapiLocator&&(e=t)}catch(e){}if(t===this.currentWindow.top)break;t=t.parent}return e},Qe.prototype.hasCallerFunctionInFrame=function(){return"function"==typeof this.currentWindow.__tcfapi},Qe.prototype.readyToRetrieve=function(){return this.hasCallerFunctionInFrame()||void 0!==this.getCMPFrame()},Qe.prototype.pingWithTimeout=function(i,e,t,n){function o(e,t){r.logger(t),clearTimeout(e),n()}var r=this;return window.setTimeout(function(){var t=window.setTimeout(function(){o(i,"Timeout: Unable to get TCFv2 ping return after "+e+"ms")},e);r.executeCommand("ping",2,function(e){clearTimeout(t),r.logger("TCFv2 CMP ping returned in ms"),"error"===e.cmpStatus?o(i,"Error status on ping to TCFv2 CMP"):!0!==e.cmpLoaded?o(i,"TCFv2 ping returned cmpLoaded = false"):r.logger("TCFv2 ping returned cmpLoaded = true")})},t)},Qe.prototype.retrieveConsent=function(i){var n=this,o=!1,r=window.setTimeout(function(){o=!0,n.logger("Timeout: Unable to resolve TCFv2 consent after "+n.timeout+"ms"),i(void 0)},this.timeout),s=!1!==this.cmpAutoDetect?this.pingWithTimeout(r,this.pingTimeout,this.pingDelay,function(){o=!0,n.logger("Timeout: Unable to ping TCFv2 API after "+n.pingTimeout+"ms"),i(void 0)}):void 0;this.executeCommand("getTCData",2,function(e,t){clearTimeout(s),o||(clearTimeout(r),t?(n.logger("TCFv2 consent retrieved in ms"),n.processResponseData(e,i)):(n.logger("Error retrieving TCFv2 consent data from CMP"),i(void 0)))},[91])},Qe.prototype.processResponseData=function(e,t){var i;if(e){var n={};void 0!==e.tcString&&(n.consentData=e.tcString),void 0!==e.gdprApplies&&(n.gdprApplies=!!e.gdprApplies),n.version=e.tcfPolicyVersion?e.tcfPolicyVersion:2,n.purposes=null===(i=null==e?void 0:e.purpose)||void 0===i?void 0:i.consents,t(n)}else this.logger("Unable to read GDPR consent data from CMP"),t(void 0)},Qe.prototype.executeCommand=function(e,t,i,n){var s=this;if(!this.hasCallerFunctionInFrame()){this.logger("No TCFv2 CMP defined on current frame");var a=this.getCMPFrame();this.currentWindow.__tcfapi=function(e,t,i,n){if(!a)return s.logger("TCFv2 CMP not found in any frame"),void i({msg:"TCFv2 CMP not found in any frame"},!1);var o=Math.random().toString(10),r={__tcfapiCall:{command:e,version:t,parameter:n,callId:o}};s.cmpCallbacks[o]=i,a.postMessage(r,"*")},this.currentWindow.addEventListener("message",function(e){var t="string"==typeof e.data?ze(e.data):e.data;if(t&&t.__tcfapiReturn&&t.__tcfapiReturn.callId&&t.__tcfapiReturn.returnValue){var i=t.__tcfapiReturn;s.cmpCallbacks&&s.cmpCallbacks[i.callId]&&"function"==typeof s.cmpCallbacks[i.callId]&&(s.cmpCallbacks[i.callId](i.returnValue,i.success),delete s.cmpCallbacks[i.callId])}},!1)}this.currentWindow.__tcfapi(e,t,i,n)},Qe);function Qe(e,t,i){void 0===i&&(i=function(e){}),this.cmpCallbacks={},this.currentWindow=e,this.timeout=t.tcfTimeout,this.pingTimeout=t.tcfPingTimeout,this.pingDelay=t.tcfPingDelay,this.cmpAutoDetect=t.cmpAutoDetect,this.logger=i}var $e=(et.prototype.checkTcfPurposeOne=function(e){return!e||!e.purposes||!0===e.purposes[1]},et.prototype.setCookie=function(e,t,i,n,o){void 0===o&&(o=!1);var r=n||document,s=r.location.hostname,a=new Date;a.setTime(a.getTime()+60*i*60*1e3);var d="expires="+a.toUTCString();if(!o)return this.setCookieString(e,t,d,void 0,r),s;for(var c=s.split("."),l=0;l<c.length;++l){var u=c.slice(c.length-l-1,c.length).join(".");this.setCookieString(e,t,d,u,r);var p=this.getCookie(e,n);if(p&&p===t)return u}return s},et.prototype.deleteCookie=function(e,t,i){void 0===i&&(i=!1),this.setCookie(e,"",0,t,i)},et.prototype.getCookie=function(e,t){if(this.cookiesEnabled)for(var i=0,n=(t||document).cookie.split(";");i<n.length;i++){var o=n[i],r=o.substr(0,o.indexOf("=")).replace(/^\s+|\s+$/g,""),s=o.substr(o.indexOf("=")+1);if(r===e)return decodeURIComponent(s)}},et.prototype.setCookieString=function(e,t,i,n,o){if(this.cookiesEnabled){var r=e+"="+encodeURIComponent(t)+";"+i+";";n&&""!==n&&(r+="domain=."+n+";"),o.cookie=r+"path=/"}},et);function et(e){this.cookiesEnabled=this.checkTcfPurposeOne(e)}var tt=(it.prototype.initializeServices=function(){var n=this;this.initializing=!0,this.retrievePrivacyConsent(function(e,t){var i={localStorageHelper:new me(n.topFrame,t),gdprConsent:t,ccpaConsentProvider:n.ccpaConsentProvider,ccpaConsent:e,cookieHelper:new $e(t)};n.services=i,n.initialized=!0,n.initializing=!1,n.postInitiliazeServicesCallbacks.forEach(function(e){e(i)})})},it.prototype.getServicesAsync=function(e){this.initialized?e(this.services):(this.postInitiliazeServicesCallbacks.push(e),this.initializing||this.initializeServices())},it.prototype.retrievePrivacyConsent=function(t){var e=this.tcfCompatibleConsentProvider.readyToRetrieve(),i=this.ccpaConsentProvider.readyToRetrieve();e||i||t(void 0,void 0);var n,o,r=[];e&&r.push(Ye),i&&r.push(Ge),e&&this.tcfCompatibleConsentProvider.retrieveConsent(function(e){r.splice(r.indexOf("TCF"),1),0===r.length?t(o,e):n=e}),i&&this.ccpaConsentProvider.retrieveConsent(function(e){r.splice(r.indexOf("CCPA"),1),0===r.length?t(e,n):o=e})},it);function it(e,t,i,n){this.initializing=!1,this.initialized=!1,this.postInitiliazeServicesCallbacks=[],this.topFrame=e||window;var o,r=(o=n,{uspApiTimeout:parseInt("50",10),tcfTimeout:parseInt("10000",10),tcfPingTimeout:Math.min(parseInt("10000",10),parseInt("50",10)),tcfPingDelay:Math.min(parseInt("10000",10),parseInt("1000",10)),cmpAutoDetect:null==o?void 0:o.cmpAutoDetect});this.ccpaConsentProvider=t||new Ge(window,r,M.Warning);var s=new Je(window,r,M.Warning),a=new Ze(window,r,M.Warning);this.tcfCompatibleConsentProvider=i||new Ye(s,a,M.Warning),this.initializeServices()}var nt,ot=(e(rt,nt=h),rt.prototype.getMetricBuilder=function(){return this.metricBuilder},rt.prototype.eval=function(e){this.evalWithTimeout(e,void 0)},rt.prototype.evalWithTimeout=function(t,i){var n=this;(this.serviceProvider||new tt).getServicesAsync(function(e){n.metricsManager||(n.metricsManager=new j(e.localStorageHelper)),n.metricBuilder||(n.metricBuilder=new k(n.metricsManager)),n.innerEval(t,n.metricBuilder,e.gdprConsent,e.ccpaConsent,i)})},rt.prototype.innerEval=function(n,o,r,s,e){var a=this,d=te(),t=rt.getCriteoAdapterBidRequest(),i=rt.getRequestAuctionStart(t),c=e||le(t&&t.timeout),l=new se(o,i,c),u=new Q(this.slots,n.context,this.urlBuilder,this.profileId,this.integrationMode,this.networkId,this.adapterVersion,{ccpaIabConsent:s,gdprConsent:r},void 0,this.viewportComputer,c,d,n.context.userIds,Math.round(new Date/1e3));if(!u.isValid()||"undefined"==typeof JSON)return M.Debug("Request ignored because it doesnt contain any slot"),void this.callbackError(void 0,void 0);var p=u.getRequest(),h=JSON.stringify(p),v=u.getUrl(),g=new ke(v,h,"application/x-www-form-urlencoded");l.sendRequest(v),g.send(function(e){try{l.requestReceived();var t=F(e)||{},i=ee(t);void 0!==a.callbackSuccess&&a.callbackSuccess(JSON.stringify(t),i),l.finish(),!0===t.user_sync&&Ne.execUserSync(n.context.remoteLogging,r,s,t),o.getMetricsManager().sendEvents(o,d,!0)}catch(e){a.reportAsyncRequestException(n,"onSuccess",e)}n.context.remoteLogging.sendErrorReport(a.urlBuilder,d),a.metricBuilder=void 0},function(e,t){try{l.requestReceived(),void 0!==a.callbackError&&a.callbackError(e,t),l.finish(),o.getMetricsManager().sendEvents(o,d,!0)}catch(e){a.reportAsyncRequestException(n,"onError",e)}n.context.remoteLogging.sendErrorReport(a.urlBuilder,d),a.metricBuilder=void 0},function(){try{l.requestReceived(!0),void 0!==a.callbackTimeout&&a.callbackTimeout(),l.finish(),o.getMetricsManager().sendEvents(o,d,!0)}catch(e){a.reportAsyncRequestException(n,"onTimeout",e)}n.context.remoteLogging.sendErrorReport(a.urlBuilder,d),a.metricBuilder=void 0},this.timeout)},rt.prototype.reportAsyncRequestException=function(e,t,i){var n=i.stack?i.stack:i.toString();e.context.remoteLogging.log("Exception","Exception caught in AsyncRequest "+t+" callback:\n"+n),M.Error("Error "+t+":\n\t"+n)},rt.getCriteoAdapterBidRequest=function(){try{return window.pbjs._bidsRequested.find(function(e){return"criteo"===e.bidderCode})}catch(e){return}},rt.getRequestAuctionStart=function(e){return e&&e.auctionStart},rt.NAME="directbidding",rt);function rt(e,t,i,n,o,r,s,a,d,c,l,u,p){var h=nt.call(this,rt.NAME)||this;return h.profileId=e,h.urlBuilder=t,h.slots=i,h.callbackSuccess=n,h.callbackError=o,h.callbackTimeout=r,h.serviceProvider=s,h.timeout=d,h.networkId=c,h.integrationMode=l,h.adapterVersion=u,h.viewportComputer=p,h.metricsManager=a,h.metricsManager&&(h.metricBuilder=new k(h.metricsManager)),h}var st,at=(e(dt,st=h),dt.prototype.eval=function(e){var t=this;if(this.cache.silentModeEnabled())return M.Debug("Request ignored because the global silent mode is enabled"),this.metricsManager.incSilentModeRequestCount(),void this.callbackSuccess("",void 0);setTimeout(function(){return t.onTimeout()},this.timeout||3e3),this.directBiddingEvent.evalWithTimeout(e,this.timeout)},dt.prototype.onSuccess=function(e,t){if(this.hasResponded=!0,void 0!==t){var i=F(e);this.cache.handleResponse(this.slots,i,t,this.hasTimeouted)}this.hasTimeouted||this.callbackSuccess(e,t),this.cache.clearExpiredItems()},dt.prototype.onError=function(e,t){this.hasResponded=!0,this.hasTimeouted||this.callbackError(e,t),this.cache.clearExpiredItems()},dt.prototype.onHttpTimeout=function(){this.hasResponded=!0,this.hasTimeouted||this.callbackTimeout(),this.cache.clearExpiredItems()},dt.prototype.onTimeout=function(){var e;if(!this.hasResponded){this.hasTimeouted=!0;var t=this.cache.getCachedBids(this.slots),i=Object.keys(t),n=i.map(function(e){return t[e]});0===Object.keys(t).length?this.callbackTimeout():(M.Debug("Cached bids returned because of timeout: ['"+n.map(function(e){return e.impid}).join("', '")+"']"),null===(e=this.getMetricBuilder())||void 0===e||e.withSlotIdsMatchedByCache(i),this.callbackSuccess(JSON.stringify({slots:n}),void 0))}},dt.prototype.getMetricBuilder=function(){return this.directBiddingEvent.getMetricBuilder()},dt.prototype.getBidCache=function(){return this.cache},dt.NAME="directbidding",dt);function dt(e,t,i,n,o,r,s,a,d,c,l,u,p,h){var v=st.call(this,dt.NAME)||this,g=Math.max(10*(c||3e3),3e3);return v.cache=a,v.directBiddingEvent=new ot(e,t,v.cache.filterNoBidSlots(i),function(e,t){return v.onSuccess(e,t)},function(e,t){return v.onError(e,t)},function(){return v.onHttpTimeout()},d,s,g,l,u,p,h),v.slots=i,v.callbackSuccess=n,v.callbackError=o,v.callbackTimeout=r,v.timeout=c,v.hasTimeouted=!1,v.hasResponded=!1,v.metricsManager=s,v}var ct={prebid:"criteo_fast_bid",index:"criteo_fast_bid_index"};function lt(e){function t(){try{return i.apply(this,arguments)}catch(e){M.Error("Exception caught: "+e.toString())}}var i=e;for(var n in t.prototype=i.prototype,i)i.hasOwnProperty(n)&&(t[n]=i[n]);return t}var ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var pt,ht,vt,gt=(function(e,t){var i;i=function(){function d(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,t=void 0,o=void 0,s=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(h):y())};var e="undefined"!=typeof window?window:void 0,r=e||{},a=r.MutationObserver||r.WebKitMutationObserver,c="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function u(){var e=setTimeout;return function(){return e(h,1)}}var p=new Array(1e3);function h(){for(var e=0;e<n;e+=2){(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0}n=0}var v,g,f,m,y=void 0;function C(e,t){var i=this,n=new this.constructor(b);void 0===n[w]&&F(n);var o=i._state;if(o){var r=arguments[o-1];s(function(){return k(o,n,r,i._result)})}else D(i,n,e,t);return n}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return R(t,e),t}y=c?function(){return process.nextTick(h)}:a?(g=0,f=new a(h),m=document.createTextNode(""),f.observe(m,{characterData:!0}),function(){m.data=g=++g%2}):l?((v=new MessageChannel).port1.onmessage=h,function(){return v.port2.postMessage(0)}):(void 0===e?function(){try{var e=Function("return this")().require("vertx");return void 0!==(t=e.runOnLoop||e.runOnContext)?function(){t(h)}:u()}catch(e){return u()}}:u)();var w=Math.random().toString(36).substring(2);function b(){}var I=void 0,_=1,S=2;function T(e,n,o){s(function(t){var i=!1,e=function(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}(o,n,function(e){i||(i=!0,(n!==e?R:P)(t,e))},function(e){i||(i=!0,x(t,e))},t._label);!i&&e&&(i=!0,x(t,e))},e)}function A(e,t,i){var n,o;t.constructor===e.constructor&&i===C&&t.constructor.resolve===E?(n=e,(o=t)._state===_?P(n,o._result):o._state===S?x(n,o._result):D(o,void 0,function(e){return R(n,e)},function(e){return x(n,e)})):void 0===i?P(e,t):d(i)?T(e,t,i):P(e,t)}function R(t,e){if(t===e)x(t,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(n=e),null===n||"object"!=o&&"function"!=o)P(t,e);else{var i=void 0;try{i=e.then}catch(e){return void x(t,e)}A(t,e,i)}var n,o}function M(e){e._onerror&&e._onerror(e._result),O(e)}function P(e,t){e._state===I&&(e._result=t,e._state=_,0!==e._subscribers.length&&s(O,e))}function x(e,t){e._state===I&&(e._state=S,e._result=t,s(M,e))}function D(e,t,i,n){var o=e._subscribers,r=o.length;e._onerror=null,o[r]=t,o[r+_]=i,o[r+S]=n,0===r&&e._state&&s(O,e)}function O(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,o=void 0,r=e._result,s=0;s<t.length;s+=3)n=t[s],o=t[s+i],n?k(i,n,o,r):o(r);e._subscribers.length=0}}function k(e,t,i,n){var o=d(i),r=void 0,s=void 0,a=!0;if(o){try{r=i(n)}catch(e){a=!1,s=e}if(t===r)return void x(t,new TypeError("A promises callback cannot return that same promise."))}else r=n;t._state!==I||(o&&a?R(t,r):!1===a?x(t,s):e===_?P(t,r):e===S&&x(t,r))}var B=0;function F(e){e[w]=B++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=(N.prototype._enumerate=function(e){for(var t=0;this._state===I&&t<e.length;t++)this._eachEntry(e[t],t)},N.prototype._eachEntry=function(t,e){var i=this._instanceConstructor,n=i.resolve;if(n===E){var o=void 0,r=void 0,s=!1;try{o=t.then}catch(e){s=!0,r=e}if(o===C&&t._state!==I)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(i===L){var a=new i(b);s?x(a,r):A(a,t,o),this._willSettleAt(a,e)}else this._willSettleAt(new i(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)},N.prototype._settledAt=function(e,t,i){var n=this.promise;n._state===I&&(this._remaining--,e===S?x(n,i):this._result[t]=i),0===this._remaining&&P(n,this._result)},N.prototype._willSettleAt=function(e,t){var i=this;D(e,void 0,function(e){return i._settledAt(_,t,e)},function(e){return i._settledAt(S,t,e)})},N);function N(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[w]||F(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&P(this.promise,this._result))):x(this.promise,new Error("Array Methods must be provided an Array"))}var L=(H.prototype.catch=function(e){return this.then(null,e)},H.prototype.finally=function(t){var i=this.constructor;return d(t)?this.then(function(e){return i.resolve(t()).then(function(){return e})},function(e){return i.resolve(t()).then(function(){throw e})}):this.then(t,t)},H);function H(e){this[w]=B++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof H?function(t,e){try{e(function(e){R(t,e)},function(e){x(t,e)})}catch(e){x(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return L.prototype.then=C,L.all=function(e){return new U(this,e).promise},L.race=function(o){var r=this;return i(o)?new r(function(e,t){for(var i=o.length,n=0;n<i;n++)r.resolve(o[n]).then(e,t)}):new r(function(e,t){return t(new TypeError("You must pass an array to race."))})},L.resolve=E,L.reject=function(e){var t=new this(b);return x(t,e),t},L._setScheduler=function(e){o=e},L._setAsap=function(e){s=e},L._asap=s,L.polyfill=function(){var e=void 0;if(void 0!==ut)e=ut;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=L},L.Promise=L},e.exports=i()}(pt={exports:{}},pt.exports),pt.exports).polyfill,ft=(mt.LoadPolyfills=function(){mt.DefineIsArray(),mt.DefineIndexOf(),mt.DefineFilter(),mt.DefinePromise()},mt.DefinePromise=function(){window.Promise||gt()},mt.DefineIsArray=function(){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)})},mt.DefineIndexOf=function(){Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){if(void 0===t&&(t=0),void 0===this)throw new TypeError("'this' is null or not defined");var i=this.length;if(0===i)return-1;if(i<=t)return-1;for(var n=Math.max(0<=t?t:i-Math.abs(t),0);n<i;){if(n in this&&this[n]===e)return n;n++}return-1})},mt.DefineFilter=function(){Array.prototype.filter||(Array.prototype.filter=function(e){if(void 0===this||void 0===this)throw new TypeError;var t=this.length;if("function"!=typeof e)throw new TypeError;for(var i=[],n=2<=arguments.length?arguments[1]:void 0,o=0;o<t;o++)if(o in this){var r=this[o];e.call(n,r,o,this)&&i.push(r)}return i})},mt);function mt(){}function yt(t,i){try{return decodeURIComponent(t)}catch(e){return void 0!==i?i:t}}(vt=ht=ht||{})[vt.None=0]="None",vt[vt.Cookie=1]="Cookie",vt[vt.LocalStorage=2]="LocalStorage";var Ct=(Et.prototype.synchronizeCriteoUid=function(e,t){var i=this;if(this.gdprConsent=e,this.topWin.addEventListener)if("complete"===this.topDoc.readyState)this.appendGumIframeIfDoesNotExist(t);else{var n=function(){i.topDoc.removeEventListener("DOMContentLoaded",n),i.topWin.removeEventListener("load",n),i.appendGumIframeIfDoesNotExist(t)};this.topWin.addEventListener("load",n,!1),this.topDoc.addEventListener("DOMContentLoaded",n,!1)}},Et.prototype.appendGumIframeIfDoesNotExist=function(r){var s=this,e=this.createGumIframe();this.topDoc.getElementById(Et.SYNCFRAME_ID)||(this.topWin.addEventListener("message",function(e){var t=e.data;if(t&&e.origin==Et.SYNCFRAME_ORIGIN)if(e.stopImmediatePropagation(),t.optout)s.setClientSideOptOut(),s.deleteClientSideUid(),s.deleteClientSideSecureId(),s.deleteBundle();else{if(t.uid&&s.setClientSideUid(t.uid),t.callbacks)for(var i=0,n="string"==typeof t.callbacks?[t.callbacks]:t.callbacks;i<n.length;i++){var o=n[i];(new Image).src=o}else t.bundle&&(s.setBundle(t.bundle),r&&r(t.enableEsp?t.bundle:""));t.removeSid?s.deleteClientSideSecureId():t.sid&&s.setClientSideSecureId(t.sid)}},!0),this.topDoc.body.appendChild(e))},Et.prototype.getClientSideUid=function(){return this.getFromAllStorages(Et.GUID_COOKIE_NAME)},Et.prototype.setClientSideUid=function(e){this.writeOnAllStorages(Et.GUID_COOKIE_NAME,e,Et.GUID_RETENTION_TIME_HOUR)},Et.prototype.deleteClientSideUid=function(){this.deleteFromAllStorage(Et.GUID_COOKIE_NAME)},Et.prototype.getBundle=function(){return this.getFromAllStorages(Et.BUNDLE_COOKIE_NAME)},Et.prototype.setBundle=function(e){this.writeOnAllStorages(Et.BUNDLE_COOKIE_NAME,e,Et.GUID_RETENTION_TIME_HOUR)},Et.prototype.deleteBundle=function(){this.deleteFromAllStorage(Et.BUNDLE_COOKIE_NAME)},Et.prototype.getClientSideOptOut=function(){var e=this.getFromAllStorages(Et.OPTOUT_COOKIE_NAME);return{value:"1"===e.value,origin:e.origin}},Et.prototype.setClientSideOptOut=function(){this.writeOnAllStorages(Et.OPTOUT_COOKIE_NAME,"1",Et.OPTOUT_RETENTION_TIME_HOUR)},Et.prototype.getClientSideSecureId=function(){return this.getFromAllStorages(Et.SECURE_ID_COOKIE_NAME)},Et.prototype.setClientSideSecureId=function(e){this.writeOnAllStorages(Et.SECURE_ID_COOKIE_NAME,e,Et.GUID_RETENTION_TIME_HOUR)},Et.prototype.deleteClientSideSecureId=function(){this.deleteFromAllStorage(Et.SECURE_ID_COOKIE_NAME)},Et.prototype.getClientSideLocalWebId=function(){return this.getFromAllStorages(Et.LOCAL_WEB_ID_COOKIE_NAME)},Et.prototype.getIfa=function(){return this.getFromAllStorages(Et.IFA_COOKIE_NAME)},Et.prototype.checkCookiesAreWriteable=function(){var e="cto_writeable";this.cookieHelper.setCookie(e,"1",1,this.topDoc,!0);var t="1"===this.cookieHelper.getCookie(e,this.topDoc);return this.cookieHelper.deleteCookie(e,this.topDoc,!0),t},Et.prototype.createGumIframe=function(){var e=this.topDoc.createElement("iframe");return e.src=this.buildSyncframeSrc(),e.id=Et.SYNCFRAME_ID,e.style.display="none",e},Et.prototype.writeOnAllStorages=function(e,t,i){this.localStorageHelper.setItem(e,t),this.cookieHelper.setCookie(e,t,i,this.topDoc,!0)},Et.prototype.getFromAllStorages=function(e){var t=this.cookieHelper.getCookie(e,this.topDoc),i=this.localStorageHelper.getItem(e)||void 0;return{value:t||i,origin:(t&&ht.Cookie)|(i&&ht.LocalStorage)}},Et.prototype.deleteFromAllStorage=function(e){this.cookieHelper.deleteCookie(e,this.topDoc,!0),this.localStorageHelper.removeItem(e)},Et.prototype.getTld=function(){var e=this.cookieHelper.setCookie(Et.TLD_TEST_COOKIE_NAME,"test",1,this.topDoc,!0);return this.cookieHelper.deleteCookie(Et.TLD_TEST_COOKIE_NAME,this.topDoc,!0),e},Et.prototype.buildSyncframeSrc=function(){var e,t,i=this.getClientSideUid(),n=this.getClientSideOptOut(),o=this.getClientSideSecureId(),r=this.getClientSideLocalWebId(),s=this.getBundle(),a=this.getIfa(),d=this.getTld(),c=encodeURIComponent((e=this.topUrl,(t=document.createElement("a")).href=e,{protocol:t.protocol,host:t.host,hostname:t.hostname,pathname:"/"===t.pathname[0]?t.pathname.slice(1):t.pathname,search:t.search,href:t.href}).hostname),l=this.canWriteCookies,u=this.localStorageHelper.localStorageEnabled,p=[];p.push("topUrl="+c),this.gdprConsent&&(void 0!==this.gdprConsent.gdprApplies&&p.push("gdpr="+(this.gdprConsent.gdprApplies?1:0)),p.push("gdpr_consent="+(this.gdprConsent.consentData?this.gdprConsent.consentData:""))),this.isDebug&&p.push("debug=1");var h=JSON.stringify({optout:n,uid:i,sid:o,origin:"publishertag",version:106,lwid:r,tld:d,bundle:s,topUrl:c,cw:l,ifa:a,lsw:u});return Et.SYNCFRAME_ENDPOINT+"?"+p.join("&")+"#"+h},Et.GUID_COOKIE_NAME="cto_idcpy",Et.GUID_RETENTION_TIME_HOUR=9360,Et.SECURE_ID_COOKIE_NAME="cto_sid",Et.LOCAL_WEB_ID_COOKIE_NAME="cto_lwid",Et.BUNDLE_COOKIE_NAME="cto_bundle",Et.OPTOUT_COOKIE_NAME="cto_optout",Et.IFA_COOKIE_NAME="id_controller_ifa",Et.OPTOUT_RETENTION_TIME_HOUR=43200,Et.TLD_TEST_COOKIE_NAME="cto_pub_test_tld",Et.SYNCFRAME_ID="criteo-syncframe",Et.SYNCFRAME_ORIGIN="https://gum.criteo.com",Et.SYNCFRAME_ENDPOINT="https://gum.criteo.com/syncframe",Et);function Et(e,t,i,n,o){this.isDebug=n,this.topWin=i,this.topDoc=i.document,this.cookieHelper=e,this.localStorageHelper=t,this.canWriteCookies=this.checkCookiesAreWriteable(),this.topUrl=o}var wt=function(e,t){this.errorType=e,this.messages=t},bt=function(e,t,i){this.environment=e,this.errors=t,this.requestId=i},It=(_t.prototype.withMessage=function(e,t){return e in this.messages||(this.messages[e]=new Array),this.messages[e].push(t),this},_t.prototype.withRequestId=function(e){return this.requestId=e,this},_t.prototype.build=function(){var e=Array();for(var t in this.messages)null!=t&&e.push(new wt(t,this.messages[t]));return new bt(this.environment,e,this.requestId)},_t);function _t(e){this.messages={},this.environment=e}var St,Tt,At=(Rt.prototype.reportPending=function(){return this.shouldSend},Rt.prototype.sendErrorReport=function(e,t){if(this.shouldSend){void 0!==t&&this.builder.withRequestId(t);var i=this.builder.build(),n=e.buildErrorUrl();n+=this.debug?"?debug=1":"";var o=JSON.stringify(i);navigator.sendBeacon&&navigator.sendBeacon(n,o),this.shouldSend=!1,this.builder=new It(Rt.environment)}},Rt.prototype.log=function(e,t){this.shouldSend=!0,this.builder.withMessage(e,t)},Rt.environment="PublisherTag Version "+W,Rt);function Rt(e){void 0===e&&(e=!1),this.builder=new It(Rt.environment),this.shouldSend=!1,this.debug=e}function Mt(e){window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],window.googletag.cmd.push(e)}(Tt=St=St||{})[Tt.InFriendlyIframe=1]="InFriendlyIframe",Tt[Tt.InUnfriendlyIframe=2]="InUnfriendlyIframe",Tt[Tt.DirectIntegration=3]="DirectIntegration";var Pt=(xt.prototype.getUserContextualData=function(){var e,t,i,n,o,r,s,a,d,c,l,u,p,h;return{data:{contentLanguage:this.getContentLanguage(),navigatorLanguage:null===(t=null===(e=this.window)||void 0===e?void 0:e.navigator)||void 0===t?void 0:t.language,orientation:this.getOrientation(),windowInnerWidth:null===(i=this.window)||void 0===i?void 0:i.innerWidth,windowInnerHeight:null===(n=this.window)||void 0===n?void 0:n.innerHeight,pageWidth:null===(s=null===(r=null===(o=this.window)||void 0===o?void 0:o.document)||void 0===r?void 0:r.documentElement)||void 0===s?void 0:s.scrollWidth,pageHeight:null===(c=null===(d=null===(a=this.window)||void 0===a?void 0:a.document)||void 0===d?void 0:d.documentElement)||void 0===c?void 0:c.scrollHeight,sessionDuration:oe.TimeSincePageLoad()},device:{w:null===(u=null===(l=this.window)||void 0===l?void 0:l.screen)||void 0===u?void 0:u.width,h:null===(h=null===(p=this.window)||void 0===p?void 0:p.screen)||void 0===h?void 0:h.height}}},xt.prototype.getOrientation=function(){var e,t,i,n,o,r;return((null===(t=null===(e=this.window)||void 0===e?void 0:e.screen)||void 0===t?void 0:t.orientation)||{}).type||(null===(n=null===(i=this.window)||void 0===i?void 0:i.screen)||void 0===n?void 0:n.mozOrientation)||(null===(r=null===(o=this.window)||void 0===o?void 0:o.screen)||void 0===r?void 0:r.msOrientation)},xt.prototype.getContentLanguage=function(){var e,t,i,n,o,r=null===(i=null===(t=null===(e=this.window)||void 0===e?void 0:e.document)||void 0===t?void 0:t.documentElement)||void 0===i?void 0:i.lang;if(!r&&"function"==typeof(null===(o=null===(n=this.window)||void 0===n?void 0:n.document)||void 0===o?void 0:o.querySelector)){var s=this.window.document.querySelector('meta[http-equiv="Content-Language"]');r=null==s?void 0:s.content}return r},xt);function xt(e){this.window=e}var Dt,Ot=(e(kt,Dt=G),kt.prototype.sendSetEspPromiseTime=function(){this.sendEvents({eventId:"SetEspPromise",elapsed:oe.TimeSincePageLoad()})},kt.prototype.sendReturnEspPromiseToGptTime=function(){this.sendEvents({eventId:"ReturnEspPromiseToGpt",elapsed:oe.TimeSincePageLoad()})},kt.prototype.sendResolveEspPromiseTime=function(){this.sendEvents({eventId:"ResolveEspPromise",elapsed:oe.TimeSincePageLoad()})},kt.prototype.sendEvents=function(e){var t={requestId:this.context.getClientSessionId(),events:[e]};this.context.isEligibleForCsmEvents()&&this.sendEventsToBeacon(t,this.urlBuilder.buildCsmEventsUrl())},kt);function kt(e){var t=Dt.call(this)||this;return t.context=e,t}var Bt=(Ft.prototype.getContextFlags=function(){var e="";return e+=this.debugMode?"&debug=1":"",e+=this.noLog?"&nolog=1":""},Ft.prototype.isEligibleForCsmEvents=function(){return this.sessionRandomId%100==0},Ft.prototype.getClientSessionId=function(){return this.clientSessionId},Ft.prototype.getMetricsManager=function(){return this.contextMetricsManager},Ft.prototype.getDisplayContext=function(e){return he.inIframe()?e.err?St.InUnfriendlyIframe:St.InFriendlyIframe:St.DirectIntegration},Ft.prototype.getQueryStringParams=function(e){var t={},i=e.split("?");if(1<i.length)for(var n=0,o=i[1].split("&");n<o.length;n++){var r=o[n].split("=");t[yt(r[0])]=yt(r[1])}return t},Ft.prototype.synchronizeCriteoUid=function(e,t,i){var n,o=this,r=(null===(n=this.cookieSynchronizerFactory)||void 0===n?void 0:n.call(this))||new Ct(t,e,this.highestAccessibleWindowStruct.topFrame,this.debugMode,this.highestAccessibleUrl);this.ctoIdOnPublisherDomain=r.getClientSideUid().value,this.isOptOut=r.getClientSideOptOut().value,this.secureId=r.getClientSideSecureId().value,this.bundle=r.getBundle().value;var s,a,d=new Promise(function(t,e){r.synchronizeCriteoUid(i,function(e){M.Debug("Resolving GPT ESP Promise"),o.contextMetricsManager.sendResolveEspPromiseTime(),t(e)})});window.googletag&&(s=this.contextMetricsManager,a=d,Mt(function(){var e;window.googletag.encryptedSignalSource=null!==(e=window.googletag.encryptedSignalSource)&&void 0!==e?e:{},M.Debug("Promise set for GPT ESP"),window.googletag.encryptedSignalSource.criteo=function(){return M.Debug("Returning Promise to GPT"),s.sendReturnEspPromiseToGptTime(),a},s.sendSetEspPromiseTime()}))},Ft.prototype.getIdfs=function(){return["",this.secureId].join(":")},Ft.prototype.setIdfs=function(e){var t=e.split(":");t[1]&&(this.secureId=t[1])},Ft.prototype.computeShouldIgnoreSilentMode=function(){return Math.floor(100*Math.random())<5},Ft.prototype.setSilentModeIgnored=function(){this.silentModeIgnored=!0},Ft.prototype.setPublisherExt=function(e){this.publisherExt=e},Ft.prototype.getPublisherExt=function(){return this.publisherExt},Ft.prototype.setUserExt=function(e){this.userExt=e},Ft.prototype.getUserExtWithContextualData=function(){this.userExt=this.userExt||{};var e=this.userContextualDataManager.getUserContextualData();return this.userExt.data=_(_({},this.userExt.data),null==e?void 0:e.data),this.userExt.device=_(_({},this.userExt.device),null==e?void 0:e.device),this.userExt},Ft);function Ft(e,t,i,n,o,r,s,a){var d=this;void 0===s&&(s=(new Date).getUTCMilliseconds()),void 0===a&&(a=te()),this.cloneByImpressionId={},this.sessionRandomId=s,this.clientSessionId=a,this.contextMetricsManager=new Ot(this),this.charset=e.charset||e.characterSet||"",this.highestAccessibleWindowStruct=he.getHighestAccessibleWindow(t),this.displayContext=this.getDisplayContext(this.highestAccessibleWindowStruct),this.highestAccessibleUrl=he.getHighestAccessibleUrl(this.highestAccessibleWindowStruct),this.cookieSynchronizerFactory=i;var c,l=this.getQueryStringParams(this.highestAccessibleUrl);this.debugMode="1"===l.pbt_debug||!1,this.noLog="1"===l.pbt_nolog||!1,this.shouldIgnoreSilentMode=this.computeShouldIgnoreSilentMode(),this.silentModeIgnored=!1,this.remoteLogging=new At(this.debugMode),this.debugMode&&(c=u.Debug,M.LOGLEVEL=c),this.location=t.location,this.dising=!1,this.ct0=void 0,this.wpdt0=void 0,this.isAdBlocked=void 0,this.rtaVarNames=[],this.serviceProvider=n||new tt(this.highestAccessibleWindowStruct.topFrame,void 0,void 0,o),this.serviceProvider.getServicesAsync(function(e){var t;(null===(t=e.ccpaConsentProvider)||void 0===t?void 0:t.hasUserOptOut(e.ccpaConsent))||d.synchronizeCriteoUid(e.localStorageHelper,e.cookieHelper,e.gdprConsent)}),this.userContextualDataManager=r||new Pt(t)}var Ut=function(){this.bids={},this.lineItemRanges=[],this.impIds=[]};var Nt,Lt,Ht,qt=(Wt.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=0,n=e;i<n.length;i++){var o=n[i];this.events.push(o)}this.evalEvents()},Wt.prototype.evalEvents=function(){for(var e=0;e<this.events.length;){var t=this.events[e];if("conditionalEvent"!==t.name||t.canEval()){var i=this.events.splice(e,1);try{i[0].eval(this)}catch(e){M.Error("An exception occurred processing an event: "+e.toString())}}else e++}},Wt.VERSION=W,Wt);function Wt(e){var t;void 0===e&&(e=null===(t=window.Criteo_prebid_106||window.Criteo)||void 0===t?void 0:t.config),this.standaloneBidder=new Ut,this.events=[],this.context=new Bt(document,window,void 0,void 0,e),M.Debug("Publisher Tag loaded")}Nt=function e(t){for(var i in t)if(i in t){var n=t[i];"function"==typeof n?t[i]=lt(n):"object"==typeof n&&(t[i]=e(n))}return t}({PubTag:{Adapters:{Prebid:We},DirectBidding:{DirectBiddingEvent:at,DirectBiddingSlot:ie,DirectBiddingUrlBuilder:K,Size:de}},events:window.Criteo?window.Criteo.events:[],passbackEvents:window.Criteo?window.Criteo.passbackEvents:[],usePrebidEvents:!window.Criteo||window.Criteo.usePrebidEvents}),window.criteo_pubtag&&"serviceProvider"in window.criteo_pubtag.context||(ft.LoadPolyfills(),window.criteo_pubtag=new qt,window.criteo_pubtag_prebid_106=window.criteo_pubtag),window.Criteo=Nt,window.Criteo_prebid_106=window.Criteo,M.Debug("Publisher Tag initialized with window.criteo_pubtag|criteo_pubtag_prebid_106, window.Criteo|Criteo_prebid_106"),!1!==window.Criteo.usePrebidEvents&&(window.Criteo.events=(Lt=window.Criteo.events,Ht={push:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(void 0!==e)for(var i=0,n=e;i<n.length;i++){var o=n[i];"function"==typeof o&<(o)()}}},Lt&&Array.isArray(Lt)&&Ht.push.apply(Ht,Lt),Ht)),window.criteo_pubtag.context.serviceProvider.getServicesAsync(function(e){var t,i,n;t=e.localStorageHelper,n=ct[i="prebid"],null===t.getItem(n,864e5)&&new ke("https://static.criteo.net/js/ld/publishertag."+i+".js",void 0,void 0,!1).send(function(e){t.setItem(n,e,864e5)},function(e,t){M.Error("Could not update FastBid"+(t?" ("+t+")":""))})})}();</script><style type="text/css">.mui-textfield.mui-textfield--float-label > label {-webkit-transition:all .15s ease-out;-moz-transition:all .15s ease-out;-o-transition:all .15s ease-out;transition:all .15s ease-out;}</style><style type="text/css">@keyframes mui-btn-inserted{from{transform:none;}to{transform:none;}}.mui-btn{animation-duration:0.0001s;animation-name:mui-btn-inserted;}@keyframes mui-dropdown-inserted{from{transform:none;}to{transform:none;}}[data-mui-toggle="dropdown"]{animation-duration:0.0001s;animation-name:mui-dropdown-inserted;}@keyframes mui-btn-inserted,mui-dropdown-inserted{from{transform:none;}to{transform:none;}}.mui-btn[data-mui-toggle="dropdown"]{animation-duration:0.0001s;animation-name:mui-btn-inserted,mui-dropdown-inserted;}@keyframes mui-tab-inserted{from{transform:none;}to{transform:none;}}[data-mui-toggle="tab"]{animation-duration:0.0001s;animation-name:mui-tab-inserted;}@keyframes mui-textfield-inserted{from{transform:none;}to{transform:none;}}.mui-textfield > input{animation-duration:0.0001s;animation-name:mui-textfield-inserted;}@keyframes mui-textfield-inserted{from{transform:none;}to{transform:none;}}.mui-textfield > textarea{animation-duration:0.0001s;animation-name:mui-textfield-inserted;}@keyframes mui-select-inserted{from{transform:none;}to{transform:none;}}.mui-select > select{animation-duration:0.0001s;animation-name:mui-select-inserted;}@keyframes mui-node-inserted{from{transform:none;}to{transform:none;}}.mui-select > select ~ .mui-event-trigger{animation-duration:0.0001s;animation-name:mui-node-inserted;}@keyframes mui-node-disabled{from{transform:none;}to{transform:none;}}.mui-select > select:disabled ~ .mui-event-trigger{animation-duration:0.0001s;animation-name:mui-node-disabled;}</style> <title>Beautiful Soup Tutorial - Tutorialspoint</title> <meta content="Beautiful Soup Tutorial - In this tutorial, we will show you, how to perform web scraping in Python using Beautiful Soup 4 for getting data out of HTML, XML and other markup languages. I" name="description"/> <meta content="C, C++, Python, Java, HTML, CSS, JavaScript, SQL, PHP, jQuery, XML, DOM, Bootstrap, Tutorials, Articles, Programming, training, learning, quiz, preferences, examples, code" name="keywords"/> <link href="https://www.tutorialspoint.com/beautiful_soup/index.htm" rel="canonical"/> <link href="https://www.tutorialspoint.com/favicon.ico" rel="shortcut icon" type="image/x-icon"/> <meta content="width=device-width,initial-scale=1.0,user-scalable=yes" name="viewport"/> <link href="./Beautiful Soup Tutorial - Tutorialspoint_files/style-min-v1.css" rel="stylesheet"/> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/analytics.js.download" type="text/javascript"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/js" type="text/javascript"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/async-ads.js.download"></script><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/script-min-v1.js.download"></script><link href="./Beautiful Soup Tutorial - Tutorialspoint_files/prettify.css" rel="stylesheet" type="text/css"/> <script> function printPage() { window.print(); } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } </script> <script data-cfasync="false" id="adp1" type="text/javascript">(function(w, d) { var s = d.createElement('script'); s.src = '//cdn.adpushup.com/40046/adpushup.js'; s.type = 'text/javascript'; s.async = true; (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); })(window, document);</script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/adpushup.js.download" type="text/javascript"></script> <script data-cfasync="false" id="adp2" type="text/javascript">(function(w, d) {var cval = readCookie('subscription_purchased');if(cval == '1'){ return; } var s = d.createElement('script'); s.src = '//delivery.adrecover.com/18107/adRecover.js'; s.type = 'text/javascript'; s.async = true; (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); })(window, document);</script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/adRecover.js.download" type="text/javascript"></script> <style> .butnn-save a{color:#fff;} .notes_msg{color:green; margin-left:20px; margin-top:15px;} .right-menu .mui-btn { background-color:#b42573; } a.demo { background:#b42573; } li.heading { background:#b42573; } .course-box{background:#b42573} .home-intro-sub p{color:#b42573} a.demo{ top: 12px; float:right; } .prettyprint{ width: 99%; } </style> <script src="./Beautiful Soup Tutorial - Tutorialspoint_files/cse_element__en.js.download" type="text/javascript"></script><link href="./Beautiful Soup Tutorial - Tutorialspoint_files/default+en.css" rel="stylesheet" type="text/css"/><link href="./Beautiful Soup Tutorial - Tutorialspoint_files/default.css" rel="stylesheet" type="text/css"/><style type="text/css">.gsc-control-cse{font-family:arial, sans-serif}.gsc-control-cse .gsc-table-result{font-family:arial, sans-serif}.gsc-refinementsGradient{background:linear-gradient(to left,rgba(233,233,233,1),rgba(233,233,233,0))}</style><style type="text/css">.gscb_a{display:inline-block;font:27px/13px arial,sans-serif}.gsst_a .gscb_a{color:#a1b9ed;cursor:pointer}.gsst_a:hover .gscb_a,.gsst_a:focus .gscb_a{color:#36c}.gsst_a{display:inline-block}.gsst_a{cursor:pointer;padding:0 4px}.gsst_a:hover{text-decoration:none!important}.gsst_b{font-size:16px;padding:0 2px;position:relative;user-select:none;-webkit-user-select:none;white-space:nowrap}.gsst_e{vertical-align:middle;opacity:0.55;}.gsst_a:hover .gsst_e,.gsst_a:focus .gsst_e{opacity:0.72;}.gsst_a:active .gsst_e{opacity:1;}.gsst_f{background:white;text-align:left}.gsst_g{background-color:white;border:1px solid #ccc;border-top-color:#d9d9d9;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);margin:-1px -3px;padding:0 6px}.gsst_h{background-color:white;height:1px;margin-bottom:-1px;position:relative;top:-1px}.gsib_a{width:100%;padding:4px 6px 0}.gsib_a,.gsib_b{vertical-align:top}.gssb_c{border:0;position:absolute;z-index:989}.gssb_e{border:1px solid #ccc;border-top-color:#d9d9d9;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);cursor:default}.gssb_f{visibility:hidden;white-space:nowrap}.gssb_k{border:0;display:block;position:absolute;top:0;z-index:988}.gsdd_a{border:none!important}.gsq_a{padding:0}.gssb_a{padding:0 7px}.gssb_a,.gssb_a td{white-space:nowrap;overflow:hidden;line-height:22px}#gssb_b{font-size:11px;color:#36c;text-decoration:none}#gssb_b:hover{font-size:11px;color:#36c;text-decoration:underline}.gssb_g{text-align:center;padding:8px 0 7px;position:relative}.gssb_h{font-size:15px;height:28px;margin:0.2em;-webkit-appearance:button}.gssb_i{background:#eee}.gss_ifl{visibility:hidden;padding-left:5px}.gssb_i .gss_ifl{visibility:visible}a.gssb_j{font-size:13px;color:#36c;text-decoration:none;line-height:100%}a.gssb_j:hover{text-decoration:underline}.gssb_l{height:1px;background-color:#e5e5e5}.gssb_m{color:#000;background:#fff}.gssb_a{padding:0 9px}.gsib_a{padding:5px 9px 4px 9px}.gscb_a{line-height:27px}.gssb_e{border:0}.gssb_l{margin:5px 0}input.gsc-input::-webkit-input-placeholder{font-size:14px}input.gsc-input:-moz-placeholder{font-size:14px}input.gsc-input::-moz-placeholder{font-size:14px}input.gsc-input:-ms-input-placeholder{font-size:14px}input.gsc-input:focus::-webkit-input-placeholder{color:transparent}input.gsc-input:focus:-moz-placeholder{color:transparent}input.gsc-input:focus::-moz-placeholder{color:transparent}input.gsc-input:focus:-ms-input-placeholder{color:transparent}.gssb_c .gsc-completion-container{position:static}.gssb_c{z-index:5000}.gsc-completion-container table{background:transparent;font-size:inherit;font-family:inherit}.gssb_c > tbody > tr,.gssb_c > tbody > tr > td,.gssb_d,.gssb_d > tbody > tr,.gssb_d > tbody > tr > td,.gssb_e,.gssb_e > tbody > tr,.gssb_e > tbody > tr > td{padding:0;margin:0;border:0}.gssb_a table,.gssb_a table tr,.gssb_a table tr td{padding:0;margin:0;border:0}</style><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/pb.1620913454202.js.download" type="text/javascript"></script><script type="text/javascript">// refreshTypes: { // 1: "Active View", -> this is default // 2: "Active Tab", // 3: "BG" // } !(function () { var REFRESH_COUNTRY_MAP = { US: { //This is the country code where the given refesh is supposed to be applicable. To make it applicable across all countries use "default" in place of country code refreshInterval: 75, // this is in seconds refreshType: 3, sectionIdsToRefresh: ['f0f6cff6-393d-4170-b63a-d9ff06ca9f25', '5c0affd5-724a-475c-bfcd-cecbc7660c36','8f8814c2-d64c-4d26-9cb9-543653c0b48f','8014640d-fd34-4b2e-9b1b-cc67234a2325'] //in case sectionIdsToRefresh list is empty it will be applicable on units/sections }, default: { refreshInterval: 30, refreshType: 2 } }; var adpushup = window.adpushup || {}; adpushup.que = window.adpushup.que || []; adpushup.que.push(function () { var customRefreshConfig = REFRESH_COUNTRY_MAP[adpushup.config.country] || REFRESH_COUNTRY_MAP['default']; customRefreshConfig.refreshType = customRefreshConfig.refreshType || REFRESH_COUNTRY_MAP['default'].refreshType; customRefreshConfig.refreshInterval = customRefreshConfig.refreshInterval || REFRESH_COUNTRY_MAP['default'].refreshInterval; if (window.location.search.indexOf('apDebug=true') !== -1) { window.currentRefreshConfig = customRefreshConfig; window.REFRESH_COUNTRY_MAP = REFRESH_COUNTRY_MAP; } var isUnitToBeRefreshed = function (sectionId, sectionIdsToRefresh) { return !sectionIdsToRefresh.length || sectionIdsToRefresh.indexOf(sectionId) !== -1; }; var setupRefreshIntervalTimeForUnits = function (customRefreshConfig) { // Handle refreshInterval Innovative ads adpushup.config.innovativeAds.forEach(function (ad) { if (ad.networkData.refreshSlot && isUnitToBeRefreshed(ad.id, customRefreshConfig.sectionIdsToRefresh)) { ad.networkData.refreshInterval = customRefreshConfig.refreshInterval; } }); // Handle refreshInterval Manual Ads adpushup.config.manualAds.forEach(function (ad, i) { if (ad.networkData.refreshSlot && isUnitToBeRefreshed(ad.id, customRefreshConfig.sectionIdsToRefresh)) { ad.networkData.refreshInterval = customRefreshConfig.refreshInterval; } }); //Handle refreshInterval Layout Ads var experiment = adpushup.config.experiment; for (var device in experiment) { for (var page_group in experiment[device]) { experiment[device][page_group].variations.forEach(function (variation, j) { variation.ads.forEach(function (ad) { if ( ad.networkData.refreshSlot && isUnitToBeRefreshed(ad.id, customRefreshConfig.sectionIdsToRefresh) ) { ad.networkData.refreshInterval = customRefreshConfig.refreshInterval; } }); }); } } }; var setupUtilsCheckElementInViewPercentFn = function (customRefreshConfig) { var utils = window.adpushup.utils; var originalCheckElementInViewPercent = utils.checkElementInViewPercent.bind(utils); //overwrite the function window.adpushup.utils.checkElementInViewPercent = function (el) { var $el = window.adpushup.$(el); var elementOrigId = !!$el.data() ? $el.data().origId : ''; if (elementOrigId && isUnitToBeRefreshed(elementOrigId, customRefreshConfig.sectionIdsToRefresh)) { switch (customRefreshConfig.refreshType) { case 1: utils.log(`ActiveView Refresh for ${elementOrigId}`); return originalCheckElementInViewPercent(el); case 2: utils.log(`ActiveTab refresh for ${elementOrigId}`); if (document.hasFocus()) { return true; } break; case 3: utils.log(`BG refresh for ${elementOrigId}`); return true; break; } } else { utils.log(`ActiveView refresh for ${elementOrigId}`); return originalCheckElementInViewPercent(el); } }; }; if (customRefreshConfig && customRefreshConfig.sectionIdsToRefresh) { setupRefreshIntervalTimeForUnits(customRefreshConfig); setupUtilsCheckElementInViewPercentFn(customRefreshConfig); } }); })(); !(function () { window._apPbJs = window._apPbJs || {}; window._apPbJs.que = window._apPbJs.que || []; var enabledBidders = adpushup.utils.getQueryParams().enabledBidders; if (enabledBidders) { enabledBiddersArray = enabledBidders.split(","); window.adpushup.utils.log(enabledBiddersArray); window._apPbJs.que.push(function () { window._apPbJs.onEvent("beforeRequestBids", function (adunits) { var filteredAdUnits = []; for (var i = 0; i < adunits.length; i++) { var bidders = []; var adUnit = adunits[i]; var adUnitBids = adUnit.bids; for (var j = 0; j < adUnitBids.length; j++) { if (enabledBiddersArray.indexOf(adUnitBids[j].bidder) !== -1) { bidders.push(adUnitBids[j]); } } adUnit.bids = bidders; filteredAdUnits.push(adUnit); } adunits = filteredAdUnits; }); }); } })(); !(function () { window._apPbJs = window._apPbJs || {}; window._apPbJs.que = window._apPbJs.que || []; var bidderFilter = function (adunits) { console.log(adunits); }; var auctionEndCallback = function (auction) { window.adpushup.utils.log(auction); }; window._apPbJs.que.push(function () { // window._apPbJs.onEvent("beforeRequestBids", bidderFilter); window._apPbJs.onEvent("auctionEnd", auctionEndCallback); }); })(); </script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/gpt.js.download"></script><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/apstag.js.download"></script><script type="text/javascript">(function($){ var $els = $('div[id^="STICKY"]'); $els.each(function(i,$el){ var span = $('<span style="cursor:pointer; position: absolute; top: -20px; right: 0; background: rgba(255,255,255,0.3); color: #000; padding: 0 5px;"> Close</span>'); $($el).append(span); span.on('click',function(){ $(this).parents('.adp_interactive_ad').remove(); }) }) })(adpushup.$)</script><meta content="A+b/H0b8RPXNaJgaNFpO0YOFuGK6myDQXlwnJB3SwzvNMfcndat4DZYMrP4ClJIzYWo3/yP2S+8FTZ/lpqbPAAEAAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=" http-equiv="origin-trial"/><meta content="A9ZgbRtm4pU3oZiuNzOsKcC8ppFSZdcjP2qYcdQrFKVzkmiWH1kdYY1Mi9x7G8+PS8HV9Ha9Cz0gaMdKsiVZIgMAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AxL6oBxcpn5rQDPKSAs+d0oxNyJYq2/4esBUh3Yx5z8QfcLu+AU8iFCXYRcr/CEEfDnkxxLTsvXPJFQBxHfvkgMAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="A9KPtG5kl3oLTk21xqynDPGQ5t18bSOpwt0w6kGa6dEWbuwjpffmdUpR3W+faZDubGT+KIk2do0BX2ca16x8qAcAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="A3HucHUo1oW9s+9kIKz8mLkbcmdaj5lxt3eiIMp1Nh49dkkBlg1Fhg4Fd/r0vL69mRRA36YutI9P/lJUfL8csQoAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==" http-equiv="origin-trial"/><meta content="A0OysezhLoCRYomumeYlubLurZTCmsjTb087OvtCy95jNM65cfEsbajrJnhaGwiTxhz38ZZbm+UhUwQuXfVPTg0AAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==" http-equiv="origin-trial"/><meta content="AxoOxdZQmIoA1WeAPDixRAeWDdgs7ZtVFfH2y19ziTgD1iaHE5ZGz2UdSjubkWvob9C5PrjUfkWi4ZSLgWk3Xg8AAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==" http-equiv="origin-trial"/><meta content="A7+rMYR5onPnACrz+niKSeFdH3xw1IyHo2AZSHmxrofRk9w4HcQPMYcpBUKu6OQ6zsdxf4m/vqa6tG6Na4OLpAQAAAB4eyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AwfG8hAcHnPa/kJ1Co0EvG/K0F9l1s2JZGiDLt2mhC3QI5Fh4qmsmSwrWObZFbRC9ieDaSLU6lHRxhGUF/i9sgoAAACBeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AwQ7dCmHkvR6FuOFxAuNnktYSQrGbL4dF+eBkrwNLALc69Wr//PnO1yzns3pjUoCaYbKHtVcnng2hU+8OUm0PAYAAACHeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><meta content="AysVDPGQTLD/Scn78x4mLwB1tMfje5jwUpAAzGRpWsr1NzoN7MTFhT3ClmImi2svDZA7V6nWGIV8YTPsSRTe0wYAAACHeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial"/><script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/pubads_impl_2021051801.js.download"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" type="text/javascript"></script><link href="https://d59ab0395fb486e599b489899dd42585.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html" rel="prefetch"/><link href="https://tpc.googlesyndication.com/safeframe/1-0-38/html/container.html" rel="prefetch"/><script type="text/javascript">(function($){ })(adpushup.$)</script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f.txt" type="text/javascript"></script><link as="script" href="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" rel="preload"/><script src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(1).txt" type="text/javascript"></script></head> <body data-gr-ext-installed="" data-new-gr-c-s-check-loaded="14.1012.0"> <header id="header"> <!-- pop-up --> <div class="pop-modal overlay-pop popdiv" style="display: none;"> <div class="modal-window small"> <span class="close" title="close">×</span> <div class="pop-content"> </div> <span class="msg"></span> </div> </div> <div class="wrap_loader"> <div class="imgLoader"><img alt="Tutorialspoint" height="70" src="./Beautiful Soup Tutorial - Tutorialspoint_files/loader.gif" width="70"/></div> </div> <input id="vu" name="vu" type="hidden" value=""/> <!-- pop-up --> <!-- Top sub-menu Starts Here --> <div class="mui-appbar mui-container-fulid top-menu"> <div class="mui-container"> <div class="top-menu-item home"> <a href="https://www.tutorialspoint.com/index.htm" target="_blank" title="TutorialsPoint - Home"><i class="fal fa-home"></i> <span>Home</span></a> </div> <div class="top-menu-item qa"> <a href="https://www.tutorialspoint.com/about/about_careers.htm" target="_blank" title="Job @ Tutorials Point"><i class="fa fa-suitcase"></i> <span>Jobs</span></a> </div> <div class="top-menu-item tools"> <a href="https://www.tutorialspoint.com/online_dev_tools.htm" target="_blank" title="Tools - Online Development and Testing Tools"><i class="fal fa-cogs"></i> <span>Tools</span></a> </div> <div class="top-menu-item coding-ground"> <a href="https://www.tutorialspoint.com/codingground.htm" target="_blank" title="Coding Ground - Free Online IDE and Terminal"><i class="fal fa-code"></i> <span>Coding Ground </span></a> </div> <div class="top-menu-item current-affairs"> <a href="https://www.tutorialspoint.com/current_affairs.htm" target="_blank" title="Daily Current Affairs"><i class="fal fa-layer-plus"></i> <span>Current Affairs</span></a> </div> <div class="top-menu-item upsc-notes"> <a href="https://www.tutorialspoint.com/upsc_ias_exams.htm" target="_blank" title="UPSC IAS Exams Notes - TutorialsPoint"><i class="fal fa-user-tie"></i> <span>UPSC Notes</span></a> </div> <div class="top-menu-item articles"> <a href="https://www.tutorialspoint.com/tutor_connect/index.php" target="_blank" title="Top Online Tutors - Tutor Connect"><i class="fal fa-user"></i> <span>Online Tutors</span></a> </div> <div class="top-menu-item whiteboard"> <a href="https://www.tutorialspoint.com/whiteboard.htm" target="_blank" title="Free Online Whiteboard"><i class="fal fa-chalkboard"></i> <span>Whiteboard</span></a> </div> <div class="top-menu-item net-meeting"> <a href="https://www.tutorialspoint.com/netmeeting.php" target="_blank" title="A free tool for online video conferencing"><i class="fal fa-chalkboard-teacher"></i> <span>Net Meeting</span></a> </div> <div class="top-menu-item articles"> <a href="https://www.tutorix.com/" rel="nofollow" target="_blank" title="Tutorx - The Best Learning App"><i class="fal fa-video"></i> <span>Tutorix</span></a> </div> <div class="top-menu-item qa login"> <a href="https://www.tutorialspoint.com/videotutorials/login.php" target="_blank" title="Tutorials Point - Login"><i class="fa fa-sign-in-alt"></i> <span>Login</span></a> </div> <div class="top-menu-item qa login"> <a href="https://www.tutorialspoint.com/videotutorials/subscription.php" target="_blank" title="Paid Package"><i class="fa fa-book-reader"></i> <span>Packages</span></a> </div> <div class="social-menu-item"> <a data-placement="bottom" href="https://www.facebook.com/tutorialspointindia" rel="nofollow" target="_blank" title="tutorialspoint @ Facebook"><i class="fab fa-facebook-f"></i></a> <a data-placement="bottom" href="https://www.twitter.com/tutorialspoint" rel="nofollow" target="_blank" title="tutorialspoint @ Twitter"><i class="fab fa-twitter"></i></a> <a data-placement="bottom" href="https://www.linkedin.com/company/tutorialspoint" rel="nofollow" target="_blank" title="tutorialspoint @ Linkedin"><i class="fab fa-linkedin-in"></i></a> <a data-placement="bottom" href="https://www.youtube.com/channel/UCVLbzhxVTiTLiVKeGV7WEBg" rel="nofollow" target="_blank" title="tutorialspoint YouTube"><i class="fab fa-youtube"></i></a> </div> </div> </div> <!-- Top sub-menu Ends Here --> <!-- Top main-menu Starts Here --> <div class="mui-appbar mui-container-fulid mui--appbar-line-height mui--z1" id="logo-menu"> <div class="mui-container"> <div class="left-menu"> <a href="https://www.tutorialspoint.com/index.htm" title="Tutorialspoint"> <img alt="tutorialspoint" class="tp-logo" src="./Beautiful Soup Tutorial - Tutorialspoint_files/logo.png"/> </a> <div class="mui-dropdown"> <a class="mui-btn mui-btn--primary categories" data-mui-toggle="dropdown"><i class="fa fa-th-large"></i> <span>Categories <span class="mui-caret"></span></span></a> <ul class="mui-dropdown__menu cat-menu"> <li> <ul> <li><a href="https://www.tutorialspoint.com/academic_tutorials.htm"><i class="fa fa-caret-right"></i> Academic Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/big_data_tutorials.htm"><i class="fa fa-caret-right"></i> Big Data & Analytics </a></li> <li><a href="https://www.tutorialspoint.com/computer_programming_tutorials.htm"><i class="fa fa-caret-right"></i> Computer Programming </a></li> <li><a href="https://www.tutorialspoint.com/computer_science_tutorials.htm"><i class="fa fa-caret-right"></i> Computer Science </a></li> <li><a href="https://www.tutorialspoint.com/database_tutorials.htm"><i class="fa fa-caret-right"></i> Databases </a></li> <li><a href="https://www.tutorialspoint.com/devops_tutorials.htm"><i class="fa fa-caret-right"></i> DevOps </a></li> <li><a href="https://www.tutorialspoint.com/digital_marketing_tutorials.htm"><i class="fa fa-caret-right"></i> Digital Marketing </a></li> <li><a href="https://www.tutorialspoint.com/engineering_tutorials.htm"><i class="fa fa-caret-right"></i> Engineering Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm"><i class="fa fa-caret-right"></i> Exams Syllabus </a></li> <li><a href="https://www.tutorialspoint.com/famous_monuments.htm"><i class="fa fa-caret-right"></i> Famous Monuments </a></li> <li><a href="https://www.tutorialspoint.com/gate_exams_tutorials.htm"><i class="fa fa-caret-right"></i> GATE Exams Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/latest_technologies.htm"><i class="fa fa-caret-right"></i> Latest Technologies </a></li> <li><a href="https://www.tutorialspoint.com/machine_learning_tutorials.htm"><i class="fa fa-caret-right"></i> Machine Learning </a></li> <li><a href="https://www.tutorialspoint.com/mainframe_tutorials.htm"><i class="fa fa-caret-right"></i> Mainframe Development </a></li> <li><a href="https://www.tutorialspoint.com/management_tutorials.htm"><i class="fa fa-caret-right"></i> Management Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/maths_tutorials.htm"><i class="fa fa-caret-right"></i> Mathematics Tutorials</a></li> <li><a href="https://www.tutorialspoint.com/microsoft_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> Microsoft Technologies </a></li> <li><a href="https://www.tutorialspoint.com/misc_tutorials.htm"><i class="fa fa-caret-right"></i> Misc tutorials </a></li> <li><a href="https://www.tutorialspoint.com/mobile_development_tutorials.htm"><i class="fa fa-caret-right"></i> Mobile Development </a></li> <li><a href="https://www.tutorialspoint.com/java_technology_tutorials.htm"><i class="fa fa-caret-right"></i> Java Technologies </a></li> <li><a href="https://www.tutorialspoint.com/python_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> Python Technologies </a></li> <li><a href="https://www.tutorialspoint.com/sap_tutorials.htm"><i class="fa fa-caret-right"></i> SAP Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/scripting_lnaguage_tutorials.htm"><i class="fa fa-caret-right"></i>Programming Scripts </a></li> <li><a href="https://www.tutorialspoint.com/selected_reading.htm"><i class="fa fa-caret-right"></i> Selected Reading </a></li> <li><a href="https://www.tutorialspoint.com/software_quality_tutorials.htm"><i class="fa fa-caret-right"></i> Software Quality </a></li> <li><a href="https://www.tutorialspoint.com/soft_skill_tutorials.htm"><i class="fa fa-caret-right"></i> Soft Skills </a></li> <li><a href="https://www.tutorialspoint.com/telecom_tutorials.htm"><i class="fa fa-caret-right"></i> Telecom Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm"><i class="fa fa-caret-right"></i> UPSC IAS Exams </a></li> <li><a href="https://www.tutorialspoint.com/web_development_tutorials.htm"><i class="fa fa-caret-right"></i> Web Development </a></li> <li><a href="https://www.tutorialspoint.com/sports_tutorials.htm"><i class="fa fa-caret-right"></i> Sports Tutorials </a></li> <li><a href="https://www.tutorialspoint.com/xml_technologies_tutorials.htm"><i class="fa fa-caret-right"></i> XML Technologies </a></li> <li><a href="https://www.tutorialspoint.com/multi_language_tutorials.htm"><i class="fa fa-caret-right"></i> Multi-Language</a></li> <li><a href="https://www.tutorialspoint.com/questions_and_answers.htm"><i class="fa fa-caret-right"></i> Interview Questions</a></li> </ul> </li> </ul> <div class="clear"></div> </div> </div> <div class="right-menu"> <div class="toc-toggle"> <a href="javascript:void(0);"><i class="fa fa-bars"></i></a> </div> <div class="mobile-search-btn"> <a href="https://www.tutorialspoint.com/index.htm"><i class="fal fa-search"></i></a> </div> <div class="search-box"> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/f(2).txt"></script> <div id="___gcse_0"><div class="gsc-control-cse gsc-control-cse-en"><div class="gsc-control-wrapper-cse" dir="ltr"><form accept-charset="utf-8" class="gsc-search-box gsc-search-box-tools"><table cellpadding="0" cellspacing="0" class="gsc-search-box"><tbody><tr><td class="gsc-input"><div class="gsc-input-box" id="gsc-iw-id1"><table cellpadding="0" cellspacing="0" class="gstl_50 gsc-input" id="gs_id50" style="width: 100%; padding: 0px;"><tbody><tr><td class="gsib_a" id="gs_tti50"><input autocomplete="off" class="gsc-input" dir="ltr" id="gsc-i-id1" name="search" size="10" spellcheck="false" style='width: 100%; padding: 0px; border: none; margin: 0px; height: auto; background: url("https://www.google.com/cse/static/images/1x/en/branding.png") left center no-repeat rgb(255, 255, 255); outline: none;' title="search" type="text"/></td><td class="gsib_b"><div class="gsst_b" dir="ltr" id="gs_st50"><a class="gsst_a" href="javascript:void(0)" role="button" style="display: none;" title="Clear search box"><span aria-hidden="true" class="gscb_a" id="gs_cb50">×</span></a></div></td></tr></tbody></table></div></td><td class="gsc-search-button"><button class="gsc-search-button gsc-search-button-v2"><svg height="13" viewbox="0 0 13 13" width="13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg></button></td><td class="gsc-clear-button"><div class="gsc-clear-button" title="clear results"> </div></td></tr></tbody></table></form><div class="gsc-results-wrapper-overlay"><div class="gsc-results-close-btn" tabindex="0"></div><div class="gsc-positioningWrapper"><div class="gsc-tabsAreaInvisible"><div aria-label="refinement" class="gsc-tabHeader gsc-inline-block gsc-tabhActive" role="tab">Custom Search</div><span class="gs-spacer"> </span></div></div><div class="gsc-positioningWrapper"><div class="gsc-tabsAreaInvisible"></div></div><div class="gsc-above-wrapper-area-invisible"><table cellpadding="0" cellspacing="0" class="gsc-above-wrapper-area-container"><tbody><tr><td class="gsc-result-info-container"><div class="gsc-result-info-invisible"></div></td><td class="gsc-orderby-container"><div class="gsc-orderby-invisible"><div class="gsc-orderby-label gsc-inline-block">Sort by:</div><div class="gsc-option-menu-container gsc-inline-block"><div class="gsc-selected-option-container gsc-inline-block"><div class="gsc-selected-option">Relevance</div><div class="gsc-option-selector"></div></div><div class="gsc-option-menu-invisible"><div class="gsc-option-menu-item gsc-option-menu-item-highlighted"><div class="gsc-option">Relevance</div></div><div class="gsc-option-menu-item"><div class="gsc-option">Date</div></div></div></div></div></td></tr></tbody></table></div><div class="gsc-adBlockInvisible"></div><div class="gsc-wrapper"><div class="gsc-adBlockInvisible"></div><div class="gsc-resultsbox-invisible"><div class="gsc-resultsRoot gsc-tabData gsc-tabdActive"><div><div class="gsc-expansionArea"></div></div></div></div></div></div><div class="gsc-modal-background-image" tabindex="0"></div></div></div></div> </div> <div class="menu-btn library-btn"> <a href="https://www.tutorialspoint.com/tutorialslibrary.htm"><i class="fal fa-cubes"></i> <span>Library</span></a> </div> <div class="menu-btn videos-btn"> <a href="https://www.tutorialspoint.com/videotutorials/index.php"><i class="fal fa-video"></i> <span>Videos</span></a> </div> <div class="menu-btn videos-btn"> <a href="https://www.tutorialspoint.com/questions/index.php"><i class="fa fa-location-arrow"></i> <span>Q/A</span></a> </div> <div class="menu-btn ebooks-btn"> <a href="https://store.tutorialspoint.com/"><i class="fal fa-book"></i> <span>eBooks</span></a> </div> <div class="mui-dropdown"> <button class="mui-btn mui-btn--primary mobile-menu" data-mui-toggle="dropdown" type="button"> <span class="mui-caret"></span> </button> <ul class="mui-dropdown__menu"> <li class="login"><a href="https://www.tutorialspoint.com/videotutorials/login.php"><i class="fal fa-sign-in-alt"></i> <span>Login</span></a></li> <li><a href="https://www.tutorialspoint.com/tutorialslibrary.htm"><i class="fal fa-cubes"></i> <span>Library</span></a></li> <li><a href="https://www.tutorialspoint.com/videotutorials/index.php"><i class="fal fa-video"></i> <span>Videos</span></a></li> <li><a href="https://store.tutorialspoint.com/"><i class="fal fa-book"></i> <span>eBooks</span></a></li> </ul> </div> </div> </div> </div> <!-- Top main-menu Ends Here --> </header> <div class="mui-container-fluid content"> <div class="mui-container"> <!-- Tutorial ToC Starts Here --> <div class="mui-col-md-3 tutorial-toc"> <div class="mini-logo"> <img alt="Beautiful Soup Tutorial" src="./Beautiful Soup Tutorial - Tutorialspoint_files/beautifulsoup-mini-logo.jpg"/> </div> <ul class="toc chapters"> <li class="heading">Beautiful Soup Tutorial</li> <li style="background-color: rgb(214, 214, 214);"><a href="https://www.tutorialspoint.com/beautiful_soup/index.htm">Beautiful Soup - Home</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_overview.htm">Beautiful Soup - Overview</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_installation.htm">Beautiful Soup - Installation</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_souping_the_page.htm">Beautiful Soup - Souping the Page</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_kinds_of_objects.htm">Beautiful Soup - Kinds of objects</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_navigating_by_tags.htm">Beautiful Soup - Navigating by Tags</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_searching_the_tree.htm">Beautiful Soup - Searching the Tree</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_modifying_the_tree.htm">Beautiful Soup - Modifying the Tree</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_encoding.htm">Beautiful Soup - Encoding</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_beautiful_objects.htm">Beautiful Soup - Beautiful Objects</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_parsing_only_section_of_a_document.htm">Parsing Only Section of a Document</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_trouble_shooting.htm">Beautiful Soup - Trouble Shooting</a></li> <li class="heading">Beautiful Soup Useful Resources</li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_quick_guide.htm">Beautiful Soup - Quick Guide</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_useful_resources.htm">Beautiful Soup - Useful Resources</a></li> <li><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_discussion.htm">Beautiful Soup - Discussion</a></li> </ul> <ul class="toc reading"> <li class="sreading">Selected Reading</li> <li><a href="https://www.tutorialspoint.com/upsc_ias_exams.htm" target="_top">UPSC IAS Exams Notes</a></li> <li><a href="https://www.tutorialspoint.com/developers_best_practices/index.htm" target="_top">Developer's Best Practices</a></li> <li><a href="https://www.tutorialspoint.com/questions_and_answers.htm" target="_top">Questions and Answers</a></li> <li><a href="https://www.tutorialspoint.com/effective_resume_writing.htm" target="_top">Effective Resume Writing</a></li> <li><a href="https://www.tutorialspoint.com/hr_interview_questions/index.htm" target="_top">HR Interview Questions</a></li> <li><a href="https://www.tutorialspoint.com/computer_glossary.htm" target="_top">Computer Glossary</a></li> <li><a href="https://www.tutorialspoint.com/computer_whoiswho.htm" target="_top">Who is Who</a></li> </ul> <div id="stickyparent" style="position: sticky;"> <div id="sticky-ad" style="height:250px;width:300px;"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="430c9911-782f-495d-88f9-69f58ca8c9a4" data-render-time="1621759319394" data-section="00000001-714f4f1d-1516-4e67-b7e2-913e26f06b24" id="00000001-714f4f1d-1516-4e67-b7e2-913e26f06b24" style="text-align: center; margin: 10px auto; width: 300px; height: 250px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("430c9911-782f-495d-88f9-69f58ca8c9a4"); }); </script> <div data-google-query-id="CNvGh6O03_ACFVTcjwodn4AC-A" id="ADP_40046_300x250_00000001-714f4f1d-1516-4e67-b7e2-913e26f06b24" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21875371528_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="1" data-load-complete="true" frameborder="0" height="250" id="google_ads_iframe_/103512698/21875371528_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21875371528_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource.html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> </div> </div> <!-- Tutorial ToC Ends Here --> <!-- Tutorial Content Starts Here --> <div class="mui-col-md-6 tutorial-content"> <div class="cover"> <img alt="Beautiful Soup Tutorial" class="img-responsive" src="./Beautiful Soup Tutorial - Tutorialspoint_files/beautifulsoup.jpg" style="width:100%; margin-top: 15px;"/> </div> <h1>Beautiful Soup Tutorial</h1> <div class="clearer"></div> <div class="tutorial-home-menu"> <form action="https://www.tutorialspoint.com/job_search.php" method="POST"> <input name="search_string" type="hidden" value="Beautiful Soup"/> <button class="tp-btn"><i class="fal fa-file-pdf"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_pdf_version.htm"> PDF Version</a></button> <button class="tp-btn"><i class="fal fa-book-reader"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_quick_guide.htm"> Quick Guide</a></button> <button class="tp-btn"><i class="fal fa-external-link"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_useful_resources.htm"> Resources</a></button> <button class="tp-btn" type="submit"><i class="fal fa-search-dollar"></i> Job Search</button> <button class="tp-btn"><i class="fal fa-comments"></i><a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_discussion.htm"> Discussion</a></button> </form> </div> <p>In this tutorial, we will show you, how to perform web scraping in Python using Beautiful Soup 4 for getting data out of HTML, XML and other markup languages. In this we will try to scrap webpage from various different websites (including IMDB). We will cover beautiful soup 4, python basic tools for efficiently and clearly navigating, searching and parsing HTML web page. We have tried to cover almost all the functionalities of Beautiful Soup 4 in this tutorial. You can combine multiple functionalities introduced in this tutorial into one bigger program to capture multiple meaningful data from the website into some other sub-program as input.</p> <h1>Audience</h1> <p>This tutorial is basically designed to guide you in scarping a web page. Basic requirement of all this is to get meaningful data out of huge unorganized set of data. The target audience of this tutorial can be anyone of:</p> <ul class="list"> <li><p>Anyone who wants to know – how to scrap webpage in python using BeautifulSoup 4.</p></li> <li><p>Any data science developer/enthusiasts or anyone, how wants to use this scraped (meaningful) data to different python data science libraries to make better decision.</p></li> </ul> <h1>Prerequisites</h1> <p>Though there is NO mandatory requirement to have for this tutorial. However, if you have any or all (supercool) prior knowledge on any below mentioned technologies that will be an added advantage −</p> <ul class="list"> <li><p>Knowledge of any web related technologies (HTML/CSS/Document object Model etc.).</p></li> <li><p>Python Language (as it is the python package).</p></li> <li><p>Developers who have any prior knowledge of scraping in any language.</p></li> <li><p>Basic understanding of HTML tree structure.</p></li> </ul> <div class="mui-container-fluid button-borders show" id="bottom_navigation"> <div class="pre-btn"> <a href="https://www.tutorialspoint.com/beautiful_soup/index.htm"><i class="fal fa-chevron-circle-left"></i> Previous Page</a> <a class="hide-on-mobile" href="javascript:printPage();"><i class="fa fa-print"></i> Print Page</a> </div> <div class="nxt-btn"> <a href="https://www.tutorialspoint.com/beautiful_soup/beautiful_soup_overview.htm">Next Page <i class="fal fa-chevron-circle-right"></i> </a> </div> </div> <div class="space-bottom" style="margin-bottom:20px;"></div> <div class="google-bottom-ads" id="google-bottom-ads"> <div>Advertisements</div> <div> <div id="adp_bottom_ads"><div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="e7ddd6f7-1ab0-494a-bade-887daa4373a0" data-render-time="1621759319402" data-section="00000001-6972cd1e-4b56-40f1-b912-4d188fba4946" id="00000001-6972cd1e-4b56-40f1-b912-4d188fba4946" style="text-align: center; margin: 10px auto; width: 580px; height: 400px; overflow: hidden; display: block;"><div data-google-query-id="CNzGh6O03_ACFVTcjwodn4AC-A" id="ADP_40046_580x400_00000001-6972cd1e-4b56-40f1-b912-4d188fba4946" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/ADP_40046_580X400_e7ddd6f7-1ab0-494a-bade-887daa4373a0_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="2" data-load-complete="true" frameborder="0" height="400" id="google_ads_iframe_/103512698/ADP_40046_580X400_e7ddd6f7-1ab0-494a-bade-887daa4373a0_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/ADP_40046_580X400_e7ddd6f7-1ab0-494a-bade-887daa4373a0_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(1).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="580"></iframe></div></div></div></div> <script> var adPos = document.getElementById('adp_bottom_ads'); var mobile_ad_id = "a8a632a6-046e-4f5c-b25f-8bc82ac89fb2"; var desktop_ad_id = "e7ddd6f7-1ab0-494a-bade-887daa4373a0"; var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { var ad_id = window.innerWidth <= 768 ? mobile_ad_id : desktop_ad_id; adPos.innerHTML = '<div id="' + ad_id + '" class="_ap_apex_ad"></div>'; adpushup.triggerAd(ad_id); }); </script> </div> <div class="space-bottom"></div> </div> </div> <!-- Tutorial Content Ends Here --> <!-- Right Column Starts Here --> <div class="mui-col-md-2 google-right-ads" id="chapter-menu" style="display: none;"> <input id="vu" name="vu" type="hidden" value=""/> <div class="space-top"></div> <div class="mui-panel"> <ul class="paid-menu" id="div-right-menu"> <li><a class="hide-on-mobile" href="javascript:printPage();" title="Print this page"><i class="fa fa-print"></i> Print</a></li> <li><a class="add_notes" href="javascript:void(0)" onclick="add_notes();" title="Add Custom Notes"><i class="fa fa-edit"></i> Add Notes</a></li> <li><a class="clsPage text-bookmark" href="javascript:void(0)" id="text-bookmark" onclick="text_bookmark()" title="Add Bookmark"><i class="fal fa-bookmark"></i> Bookmark this page </a></li> <li><a href="javascript:void(0);" id="report_error_popup" onclick="report_error_popup();" title="Report Error"><i class="fal fa-bell"></i> Report Error</a></li> <li><a href="javascript:void(0);" id="suggestion_popup" onclick="suggestion_popup();" title="Give Suggestions"><i class="fal fa-badge-check"></i> Suggestions</a></li> </ul> <div class="profile-my-notes" id="text_notes_div" style="display:none;"> <textarea class="text_notes" id="text_notes" name="text_notes" placeholder="Enter your custom notes..." rows="10"></textarea> <br/> <a class="butn-save" href="javascript:void(0);" id="submit_text_notes" onclick="submit_text_notes();"> Save</a> <a class="pop-no butn-cancel" href="javascript:void(0);" onclick="notesClose();"> Close</a> <p class="notes_msg"></p> </div> <div class="bottom-menu"> <button class="tp-btn"><i class="fal fa-box-up"></i> <a href="https://www.tutorialspoint.com/videotutorials/dashboard.php">Dashboard</a></button> <button class="tp-btn"><i class="fal fa-sign-out-alt"></i> <a href="https://www.tutorialspoint.com/videotutorials/userlogout.php">Logout</a></button> </div> </div> </div> <div class="mui-col-md-2 google-right-ads" id="google-right-ads"> <div class="space-top"></div> <div class="google-right-ad" style="margin: 0px auto !important;margin-top:5px;min-height:250px!important"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="f0f6cff6-393d-4170-b63a-d9ff06ca9f25" data-refresh-time="1621760401638" data-render-time="1621759319405" data-section="00000001-77807d47-104e-457e-8302-ed3f4612fa90" data-timeout="233" id="00000001-77807d47-104e-457e-8302-ed3f4612fa90" style="text-align: center; margin: 10px auto; width: 300px; height: 250px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("f0f6cff6-393d-4170-b63a-d9ff06ca9f25"); }); </script> <div data-google-query-id="CIOkpqa43_ACFY0UjwodY4QF-g" id="ADP_40046_300x250_00000001-77807d47-104e-457e-8302-ed3f4612fa90" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21871305451_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="8" data-load-complete="true" frameborder="0" height="250" id="google_ads_iframe_/103512698/21871305451_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21871305451_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(2).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> <div class="google-right-ad" style="margin-top:16px;min-height:250px!important"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="5c0affd5-724a-475c-bfcd-cecbc7660c36" data-refresh-time="1621760401642" data-render-time="1621759319407" data-section="00000001-ef31da0f-9822-401f-be58-4ee0e808e24c" data-timeout="235" id="00000001-ef31da0f-9822-401f-be58-4ee0e808e24c" style="text-align: center; margin: 10px auto; width: 300px; height: 250px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("5c0affd5-724a-475c-bfcd-cecbc7660c36"); }); </script> <div data-google-query-id="CJjno6a43_ACFY0UjwodY4QF-g" id="ADP_40046_300x250_00000001-ef31da0f-9822-401f-be58-4ee0e808e24c" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21871305739_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="9" data-load-complete="true" frameborder="0" height="250" id="google_ads_iframe_/103512698/21871305739_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21871305739_0" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(3).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> <div class="google-right-ad" style="margin-top:16px;margin-bottom:15px;min-height:600px!important"> <div class="_ap_apex_ad" data-ap-network="adpTags" data-orig-id="8f8814c2-d64c-4d26-9cb9-543653c0b48f" data-render-time="1621759319409" data-section="00000001-00b877d5-3efd-43ad-b382-ac6898cf663d" id="00000001-00b877d5-3efd-43ad-b382-ac6898cf663d" style="text-align: center; margin: 10px auto; width: 300px; height: 600px; overflow: hidden; display: block;"> <script> var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd("8f8814c2-d64c-4d26-9cb9-543653c0b48f"); }); </script> <div data-google-query-id="CN_Gh6O03_ACFVTcjwodn4AC-A" id="ADP_40046_300x600_00000001-00b877d5-3efd-43ad-b382-ac6898cf663d" style="text-align: center; margin: 0 auto;"> <div id="google_ads_iframe_/103512698/21875371402_0__container__" style="border: 0pt none;"><iframe allow="conversion-measurement 'src'" data-google-container-id="5" data-load-complete="true" frameborder="0" height="600" id="google_ads_iframe_/103512698/21875371402_0" marginheight="0" marginwidth="0" name="google_ads_iframe_/103512698/21875371402_0" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(4).html" style="border: 0px; vertical-align: bottom;" title="3rd party ad content" width="300"></iframe></div></div></div> </div> <div class="space-bottom" style="margin-bottom:15px;"></div> </div> <!-- Right Column Ends Here --> </div> </div> <div class="clear"></div> <footer id="footer"> <div class="mui--text-center"> <div class="mui--text-caption mui--text-light"> <a class="logo" href="https://www.tutorialspoint.com/index.htm"><img alt="Tutorials Point" class="img-responsive" src="./Beautiful Soup Tutorial - Tutorialspoint_files/logo-black.png" title="Tutorials Point"/></a> </div> <ul class="mui-list--inline mui--text-body2 mui--text-light"> <li><a href="https://www.tutorialspoint.com/about/index.htm"><i class="fal fa-globe"></i> About us</a></li> <li><a href="https://www.tutorialspoint.com/about/return_refund_policy.htm"> <i class="fal fa-asterisk"></i> Refund Policy</a></li> <li><a href="https://www.tutorialspoint.com/about/about_terms_of_use.htm"><i class="fal fa-asterisk"></i> Terms of use</a></li> <li><a href="https://www.tutorialspoint.com/about/about_privacy.htm"> <i class="fal fa-shield-check"></i> Privacy Policy</a></li> <li><a href="https://www.tutorialspoint.com/about/faq.htm"><i class="fal fa-question-circle"></i> FAQ's</a></li> <li><a href="https://www.tutorialspoint.com/about/contact_us.htm"><i class="fal fa-map-marker-alt"></i> Contact</a></li> </ul> <div class="mui--text-caption mui--text-light bottom-copyright-text">© Copyright 2021. All Rights Reserved.</div> </div> <script async="" src="./Beautiful Soup Tutorial - Tutorialspoint_files/js(1)"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-232293-6'); </script> <script src="./Beautiful Soup Tutorial - Tutorialspoint_files/text_menu.js.download"></script> <script> $(document).ready(function (){ var cval = readCookie('subscription_purchased'); if(cval == '1'){ // logged in and purchased subscription. $('#google-right-ads').remove(); $('#adp1').remove(); $('#adp2').remove(); $('#stickyparent').remove(); $('#google-top-ads').remove(); $('#adp_top_ads').remove(); $('#google-bottom-ads').remove(); $('.tutorial-content hr').remove(); $('.login').remove(); $('#chapter-menu').show(); $('.content h1').css("border-bottom", "none"); $('.google-right-ads').css("padding-right", "0px"); $('.tutorial-content').css("border-radius", "10px"); $('#chapter-menu .mui-panel').css("border-radius", "10px"); } }); </script> </footer> <table cellpadding="0" cellspacing="0" class="gstl_50 gssb_c" style="width: 213px; display: none; top: 91px; position: absolute; left: 1151px;"><tbody><tr><td class="gssb_f"></td><td class="gssb_e" style="width: 100%;"></td></tr></tbody></table><div id="highlighter--hover-tools" style="display: none;"> <div id="highlighter--hover-tools--container"> <div class="highlighter--icon highlighter--icon-copy" title="Copy"></div> <div class="highlighter--separator"></div> <div class="highlighter--icon highlighter--icon-change-color" title="Change Color"></div> <div class="highlighter--separator"></div> <div class="highlighter--icon highlighter--icon-delete" title="Delete"></div> </div> </div><iframe id="criteo-syncframe" src="./Beautiful Soup Tutorial - Tutorialspoint_files/syncframe.html" style="display: none;"></iframe><iframe id="google_osd_static_frame_3079649016572" name="google_osd_static_frame" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(5).html" style="display: none; width: 0px; height: 0px;"></iframe></body><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="1453ad4bda850f44" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/ixmatch.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="1461e0473fc86621" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/saved_resource(6).html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="147f415d7a18a173" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/pd.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="14873978b330cb4b" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/usync.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="1499e372c336a66f" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/showad.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="150b6de20b6fde28" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/async_usersync.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe><iframe allowtransparency="true" frameborder="0" height="0" hspace="0" id="151c6e0e9dc13e2" marginheight="0" marginwidth="0" sandbox="allow-scripts allow-same-origin" scrolling="no" src="./Beautiful Soup Tutorial - Tutorialspoint_files/sync.html" style="height:0px;width:0px;display:none;" vspace="0" width="0"> </iframe></Strong>
# Attributes (tag.attrs)
attribute1 = BeautifulSoup('<div class="TutorialsP"></div>', 'lxml')
tag2 = attribute1.div
print(tag2['class'])
['TutorialsP']
tag2['class'] = 'Online Learning'
tag2['style'] = 'background-color:red'
print(tag2)
<div class="Online Learning" style="background-color:red"></div>
del tag2['style']
print(tag2)
<div class="Online Learning"></div>
print(soup.p.prettify())
<p> In this tutorial, we will show you, how to perform web scraping in Python using Beautiful Soup 4 for getting data out of HTML, XML and other markup languages. In this we will try to scrap webpage from various different websites (including IMDB). We will cover beautiful soup 4, python basic tools for efficiently and clearly navigating, searching and parsing HTML web page. We have tried to cover almost all the functionalities of Beautiful Soup 4 in this tutorial. You can combine multiple functionalities introduced in this tutorial into one bigger program to capture multiple meaningful data from the website into some other sub-program as input. </p>
print(attribute1.prettify())
<html> <body> <div class="Online Learning"> </div> </body> </html>
print(attribute1.div.prettify())
<div class="Online Learning"> </div>
# Navigating by Tags
html_doc = """
<html><head><title>Tutorials Point</title></head>
<body>
<p class="title"><b>The Biggest Online Tutorials Library, It's all Free</b></p>
<p class="prog">Top 5 most used Programming Languages are:
<a href="https://www.tutorialspoint.com/java/java_overview.htm" class="prog" id="link1">Java</a>,
<a href="https://www.tutorialspoint.com/cprogramming/index.htm" class="prog" id="link2">C</a>,
<a href="https://www.tutorialspoint.com/python/index.htm" class="prog" id="link3">Python</a>,
<a href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" class="prog" id="link4">JavaScript</a> and
<a href="https://www.tutorialspoint.com/ruby/index.htm" class="prog" id="link5">C</a>;
as per online survey.</p>
<p class="prog">Programming Languages</p>
"""
soup = BeautifulSoup(html_doc, 'html.parser')
soup.html.prettify()
'<html>\n <head>\n <title>\n Tutorials Point\n </title>\n </head>\n <body>\n <p class="title">\n <b>\n The Biggest Online Tutorials Library, It\'s all Free\n </b>\n </p>\n <p class="prog">\n Top 5 most used Programming Languages are:\n <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">\n Java\n </a>\n ,\n <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2">\n C\n </a>\n ,\n <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3">\n Python\n </a>\n ,\n <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4">\n JavaScript\n </a>\n and\n <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5">\n C\n </a>\n ;\nas per online survey.\n </p>\n <p class="prog">\n Programming Languages\n </p>\n </body>\n</html>'
print(soup.html.prettify())
<html> <head> <title> Tutorials Point </title> </head> <body> <p class="title"> <b> The Biggest Online Tutorials Library, It's all Free </b> </p> <p class="prog"> Top 5 most used Programming Languages are: <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1"> Java </a> , <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2"> C </a> , <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3"> Python </a> , <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4"> JavaScript </a> and <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5"> C </a> ; as per online survey. </p> <p class="prog"> Programming Languages </p> </body> </html>
print(soup.a)
<a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">Java</a>
Htag = soup.head
print(Htag.contents)
[<title>Tutorials Point</title>]
Ttag = Htag.contents[0]
print(Ttag)
<title>Tutorials Point</title>
print(Ttag.contents)
['Tutorials Point']
print(len(Ttag))
1
print(len(Ttag.contents[0]))
15
text = Ttag.contents[0]
print(Ttag.contents)
['Tutorials Point']
for child in Htag.children:
print(child)
<title>Tutorials Point</title>
for child in Ttag.children:
print(child)
Tutorials Point
# descendants
for child in Htag.descendants:
print(child)
<title>Tutorials Point</title> Tutorials Point
print(len(list(soup.children)))
2
print(len(list(soup.descendants)))
33
# Strings
print(Ttag.string)
Tutorials Point
for string in soup.strings:
print(repr(string))
'\n' 'Tutorials Point' '\n' '\n' "The Biggest Online Tutorials Library, It's all Free" '\n' 'Top 5 most used Programming Languages are:\n' 'Java' ',\n' 'C' ',\n' 'Python' ',\n' 'JavaScript' ' and\n' 'C' ';\nas per online survey.' '\n' 'Programming Languages' '\n'
# Searching the Tree
print(soup.find_all('p'))
[<p class="title"><b>The Biggest Online Tutorials Library, It's all Free</b></p>, <p class="prog">Top 5 most used Programming Languages are: <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">Java</a>, <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2">C</a>, <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3">Python</a>, <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4">JavaScript</a> and <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5">C</a>; as per online survey.</p>, <p class="prog">Programming Languages</p>]
print(soup.find_all(True))
[<html><head><title>Tutorials Point</title></head> <body> <p class="title"><b>The Biggest Online Tutorials Library, It's all Free</b></p> <p class="prog">Top 5 most used Programming Languages are: <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">Java</a>, <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2">C</a>, <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3">Python</a>, <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4">JavaScript</a> and <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5">C</a>; as per online survey.</p> <p class="prog">Programming Languages</p> </body></html>, <head><title>Tutorials Point</title></head>, <title>Tutorials Point</title>, <body> <p class="title"><b>The Biggest Online Tutorials Library, It's all Free</b></p> <p class="prog">Top 5 most used Programming Languages are: <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">Java</a>, <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2">C</a>, <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3">Python</a>, <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4">JavaScript</a> and <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5">C</a>; as per online survey.</p> <p class="prog">Programming Languages</p> </body>, <p class="title"><b>The Biggest Online Tutorials Library, It's all Free</b></p>, <b>The Biggest Online Tutorials Library, It's all Free</b>, <p class="prog">Top 5 most used Programming Languages are: <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">Java</a>, <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2">C</a>, <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3">Python</a>, <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4">JavaScript</a> and <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5">C</a>; as per online survey.</p>, <a class="prog" href="https://www.tutorialspoint.com/java/java_overview.htm" id="link1">Java</a>, <a class="prog" href="https://www.tutorialspoint.com/cprogramming/index.htm" id="link2">C</a>, <a class="prog" href="https://www.tutorialspoint.com/python/index.htm" id="link3">Python</a>, <a class="prog" href="https://www.tutorialspoint.com/javascript/javascript_overview.htm" id="link4">JavaScript</a>, <a class="prog" href="https://www.tutorialspoint.com/ruby/index.htm" id="link5">C</a>, <p class="prog">Programming Languages</p>]
for tag in soup.find_all(True):
print(tag.name)
html head title body p b p a a a a a p
All HTML or XML documents are written in some specific encoding like ASCII or UTF-8. However, when you load that HTML/XML document into BeautifulSoup, it has been converted to Unicode.
# Comparing Objects for Equality
markup = "<p>Learn Python and <b>Java</b> and advanced <b>Java</b>! from Tutorialspoint</p>"
soup = BeautifulSoup(markup, "html.parser")
first_b, second_b = soup.find_all('b')
print(first_b == second_b)
True
print(first_b.previous_element == second_b.previous_element)
False
print(first_b is second_b)
False
Remaining portion is SoupStrainer