title: How can I get the "hiRes" field in script ? Python Scraping Bs4
body: <p><strong>I want to get a all high quality images url of the product from the amazon page. I access the data in the script with this code. But I failed to get hiRes Url in the script. How can I break this script and get the url you want?
  Is it possible to do this with Json?</strong></p>
  <pre><code>from bs4 import BeautifulSoup
  import time
  import pandas as pd
  import random
  import requests
  import re
  from lxml import etree
  from random import choice
  import json
  
  random1 = random.randrange(7, 10, 1)
  random2 = random.randrange(70, 79, 1)
  random3 = random.randrange(100, 130, 1)
  random4 = random.randrange(5000, 9999, 1)
  
  headers = {
          'User-Agent': &quot;Mozilla/5.0 (Windows NT &quot;+str(random1)+&quot;.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/&quot;+str(random2)+&quot;.0.&quot;+str(random4)+&quot;.&quot;+str(random3)+&quot; Safari/537.36&quot;,
          'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
          'Accept-Language': 'en-US,en;q=0.5',
          'Accept-Encoding': 'gzip, deflate, br',
          'Connection': 'keep-alive',
          'Upgrade-Insecure-Requests': '1',
          'TE': 'Trailers'}
  
  url = &quot;https://www.amazon.com/dp/B079JQ9XXV/?th=1&amp;psc=1&quot;
  
  req = requests.get(url, headers=headers)
  
  soup = BeautifulSoup(req.content,&quot;html5lib&quot;)
  
  data = soup.select(&quot;#imageBlock_feature_div &gt; script:nth-child(2)&quot;)
  print (data)
  </code></pre>
  <p><strong>The output of the code is like this:</strong></p>
  <pre><code>[&lt;script type=&quot;text/javascript&quot;&gt;
  P.when('A').register(&quot;ImageBlockATF&quot;, function(A){
  var data = {
  'colorImages': { 'initial': [{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SL1500_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41EiPhPDK5L._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41EiPhPDK5L._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;MAIN&quot;,&quot;lowRes&quot;:null},{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SL1500_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41N9KFoYKoL._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41N9KFoYKoL._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/61zCQSTDE-L._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;PT01&quot;,&quot;lowRes&quot;:null},{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SL1500_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/4182H8952zL._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/4182H8952zL._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/61i%2BYShtPDL._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;PT02&quot;,&quot;lowRes&quot;:null},{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SL1348_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/412bXbalmtL._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/412bXbalmtL._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/61DWDTdsasL._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;PT03&quot;,&quot;lowRes&quot;:null},{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SL1500_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41%2BX1BNNQsL._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41%2BX1BNNQsL._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/615s8yG33VL._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;PT04&quot;,&quot;lowRes&quot;:null},{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SL1500_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41Y4Vo4qWPL._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/41Y4Vo4qWPL._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/71IDxOU0AAL._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;PT05&quot;,&quot;lowRes&quot;:null},{&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SL1500_.jpg&quot;,&quot;thumb&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/31gMtEgw1aL._AC_US40_.jpg&quot;,&quot;large&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/31gMtEgw1aL._AC_.jpg&quot;,&quot;main&quot;:{&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SY355_.jpg&quot;:[355,355],&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SY450_.jpg&quot;:[450,450],&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SX425_.jpg&quot;:[425,425],&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SX466_.jpg&quot;:[466,466],&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SX522_.jpg&quot;:[522,522],&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SX569_.jpg&quot;:[569,569],&quot;https://images-na.ssl-images-amazon.com/images/I/61%2BkttmqLiL._AC_SX679_.jpg&quot;:[679,679]},&quot;variant&quot;:&quot;PT06&quot;,&quot;lowRes&quot;:null}]},
  'colorToAsin': {'initial': {}},
  'holderRatio': 1.0,
  'holderMaxHeight': 700,
  'heroImage': {'initial': []},
  'heroVideo': {'initial': []},
  'spin360ColorData': {'initial': {}},
  'spin360ColorEnabled': {'initial': 0},
  'spin360ConfigEnabled': false,
  'spin360LazyLoadEnabled': false,
  'showroomEnabled': false,
  'showroomViewModel': {'initial': {}},
  'playVideoInImmersiveView':true,
  'useTabbedImmersiveView':true,
  'totalVideoCount':'0',
  'videoIngressATFSlateThumbURL':'',
  'mediaTypeCount':'0',
  'atfEnhancedHoverOverlay' : false,
  'winningAsin': 'B079JQ9XXV',
  'weblabs' : {},
  'aibExp3Layout' : 0,
  'aibRuleName' : 'frank-powered',
  'acEnabled' : true,
  'dp60VideoPosition': 0,
  'dp60VariantList': '',
  'dp60VideoThumb': '',
  'dp60MainImage': 'https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SY355_.jpg',
  
  'airyConfig' :A.$.parseJSON('{&quot;jsUrl&quot;:&quot;https://images-na.ssl-images-amazon.com/images/G/01/vap/video/airy2/prod/2.0.1460.0/js/airy.skin._CB485981857_.js&quot;,&quot;cssUrl&quot;:&quot;https://images-na.ssl-images-amazon.com/images/G/01/vap/video/airy2/prod/2.0.1460.0/css/beacon._CB485971591_.css&quot;,&quot;swfUrl&quot;:&quot;https://images-na.ssl-images-amazon.com/images/G/01/vap/video/airy2/prod/2.0.1460.0/flash/AiryBasicRenderer._CB485925577_.swf&quot;,&quot;foresterMetadataParams&quot;:{&quot;marketplaceId&quot;:&quot;ATVPDKIKX0DER&quot;,&quot;method&quot;:&quot;Ce.ImageBlock&quot;,&quot;requestId&quot;:&quot;03QTEGPJ7069REHEVVR7&quot;,&quot;session&quot;:&quot;144-8953114-9602366&quot;,&quot;client&quot;:&quot;Dpx&quot;}}')
  
  };
  A.trigger('P.AboveTheFold'); // trigger ATF event.
  return data;
  });
  &lt;/script&gt;]
  </code></pre>
  <p>I want the take this field.</p>
  <pre><code>&quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61vyQkBBbLL._AC_SL1500_.jpg
  &quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/54BBbLL._AC_SL1123_.jpg
  &quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61124BBbLL._AC_SL12340_.jpg
  &quot;hiRes&quot;:&quot;https://images-na.ssl-images-amazon.com/images/I/61v654bLL._AC_SL1430_.jpg
  </code></pre>