Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to extract JSON response using Python
    primarykey
    data
    text
    <p>i have this link URL from where i am trying to scrape a JSON response... This is the URL that i am trying for,</p> <p><a href="http://www.massimodutti.com/webapp/wcs/stores/servlet/ItxSolrSearchingDataCmd?catalogId=30220002&amp;langId=-1&amp;storeId=34009456&amp;searchTerm=blazer" rel="nofollow">http://www.massimodutti.com/webapp/wcs/stores/servlet/ItxSolrSearchingDataCmd?catalogId=30220002&amp;langId=-1&amp;storeId=34009456&amp;searchTerm=blazer</a></p> <p>when i open the page source, I find JSON, under </p> <pre><code> &lt;script type="text/javascript"&gt; var searchProductJSON= { "doc": { "name": "categoryProducts", "version": "0.2" }, "id": "", "items": [ { "id": "2958060", "type": "ProductBean", "name": "GREY SUIT JACKET", "ref": "06017761-I2013", "isNew": "", "onSale": 0, "curPrice": "&amp;pound;145&lt;span class='decimal'&gt;.00&lt;/span&gt;", "oldPrice": "", "numPrice": "145.00000", "colors": 1 , "numColors" : "1", "colorCutImages": ["/2013/I/0/1/p/6017/761/802/6017761802_3_1_5.jpg?timestamp=1374079181922"], "colorImages": [{ "cutImage": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6017/761/802/6017761802_3_1_6.jpg", "imageColor": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6017/761/802/6017761802_1_1_3.jpg", "linkColor": "http://www.massimodutti.com/webapp/wcs/stores/servlet/product/duttigb/en/30220002/0/2958060/GREY%2BSUIT%2BJACKET/802" }], "attr": { "feature": [], "nameFeature": [], "color": [], "nameColor": [], "size": [], "nameSize": [], "style": [], "nameStyle": [], "cats": [] }, "linkProduct": "http://www.massimodutti.com/webapp/wcs/stores/servlet/product/duttigb/en/30220002/0/2958060/GREY%2BSUIT%2BJACKET", "link": { "JSON": "http://www.massimodutti.com/webapp/wcs/stores/servlet/ProductJSON?catalogId=30220002&amp;langId=-1&amp;productId=2958060&amp;storeId=34009456", "full": "http://www.massimodutti.com/webapp/wcs/stores/servlet/product/duttigb/en/30220002/0/2958060/GREY%2BSUIT%2BJACKET" }, "image": { "zoom": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6017/761/802/6017761802_1_1_2.jpg", "aux": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6017/761/802/6017761802_2_1_3.jpg", "standard": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6017/761/802/6017761802_1_1_3.jpg" }, "labels": { "isLookbookLabel": 0, "urlNewLabel": "", "urlLookbookLabel": "", "urlLabels": [], "isNewLabel": 0 }, "bundleProductSummaries":[] } , { "id": "3137509", "type": "ProductBean", "name": "NY BELTED BLAZER", "ref": "06027843-I2013", "isNew": "", "onSale": 0, "curPrice": "&amp;pound;195&lt;span class='decimal'&gt;.00&lt;/span&gt;", "oldPrice": "", "numPrice": "195.00000", "colors": 1 , "numColors" : "1", "colorCutImages": ["http://static.massimodutti.net/3/photos/2013/I/0/1/p/6027/843/807/6027843807_3_1_5.jpg?timestamp=1377593014200"], "colorImages": [{ "cutImage": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6027/843/807/6027843807_3_1_6.jpg", "imageColor": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6027/843/807/6027843807_1_1_3.jpg", "linkColor": "http://www.massimodutti.com/webapp/wcs/stores/servlet/product/duttigb/en/30220002/0/3137509/NY%2BBELTED%2BBLAZER/807" }], "attr": { "feature": [], "nameFeature": [], "color": [], "nameColor": [], "size": [], "nameSize": [], "style": [], "nameStyle": [], "cats": [] }, "linkProduct": "http://www.massimodutti.com/webapp/wcs/stores/servlet/product/duttigb/en/30220002/0/3137509/NY%2BBELTED%2BBLAZER", "link": { "JSON": "http://www.massimodutti.com/webapp/wcs/stores/servlet/ProductJSON?catalogId=30220002&amp;langId=-1&amp;productId=3137509&amp;storeId=34009456", "full": "http://www.massimodutti.com/webapp/wcs/stores/servlet/product/duttigb/en/30220002/0/3137509/NY%2BBELTED%2BBLAZER" }, "image": { "zoom": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6027/843/807/6027843807_1_1_2.jpg", "aux": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6027/843/807/6027843807_2_1_3.jpg", "standard": "http://static.massimodutti.net/3/photos/2013/I/0/1/p/6027/843/807/6027843807_1_1_3.jpg" }, "labels": { "isLookbookLabel": 0, "urlNewLabel": "", "urlLookbookLabel": "", "urlLabels": [], "isNewLabel": 0 }, "bundleProductSummaries":[] } ], "urlImg": "http://static.massimodutti.net/3/static2", "imgPrefix": "http://static.massimodutti.net/3/photos", "urlPrefix": "", "modal": "new ItxPopUpCachedProductView({productUrl: '&amp;productId=$id'});" } &lt;/script&gt; &lt;script type="text/javascript"&gt; nlInputBinds(); slideWhowBinds(); load_search_products(searchProductJSON); if(!isIPad()){ jQuery(window).bind('resize', function() { positions_products(); fitFooterBottom($('#grid')); }); } else{ $("#content").removeClass("center"); $(window).bind('orientationchange', function(e, onready){ fitFooterBottom($('#grid')); }); if (!isIPad_5()){ setTimeout(function(){ $('body').css({'background':'url("'+DUTTI_STATIC_CONTENT_PATH+'/img/fondo_parrilla.png") repeat-y scroll 0 0 #EDEAE6'}); },1000); } } setGlobalProperties(3000,1000,500); setTimeout(function(){ fitFooterBottom($('#grid')); },3000); &lt;/script&gt; &lt;/body&gt; </code></pre> <p></p> <p>how do i scrape only the json part, i am able to take the entire tag, using the following code, but while using charles web debugger to reverse the requests made by the iphone app, it makes the same url request, and the response is the same JSON file...</p> <p>i used the following code,</p> <pre><code>import urllib from bs4 import BeautifulSoup url = "http://www.massimodutti.com/webapp/wcs/stores/servlet/ItxSolrSearchingDataCmd?catalogId=30220002&amp;langId=-1&amp;storeId=34009456&amp;searchTerm=leather" soup = BeautifulSoup(urllib.urlopen(url).read()) data = soup.find_all("script") if data: print 'yes' desired= data[62] else: print 'no' print desired </code></pre> <p>Any ideas how to go about it???</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload