Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python urllib2/requests不显示网页的iframe_Python_Iframe_Beautifulsoup_Urllib2_Python Requests - Fatal编程技术网

Python urllib2/requests不显示网页的iframe

Python urllib2/requests不显示网页的iframe,python,iframe,beautifulsoup,urllib2,python-requests,Python,Iframe,Beautifulsoup,Urllib2,Python Requests,我正试图从www.amazon.in中删除一些图书数据 我需要那本书的摘要,它位于一个iframe中,但问题是当我试图使用“请求”打开该url时,它不包含iframe 例如,当我 bookPage = requests.get(bookURL).text bookSoup = BeautifulSoup(bookPage, "lxml") bookPage中没有iframe,但实际页面包含它 我也尝试过使用urllib2,但它似乎不起作用 有什么问题吗?您可以从div元素中的noscript

我正试图从www.amazon.in中删除一些图书数据

我需要那本书的摘要,它位于一个iframe中,但问题是当我试图使用“请求”打开该url时,它不包含iframe

例如,当我

bookPage = requests.get(bookURL).text
bookSoup = BeautifulSoup(bookPage, "lxml")
bookPage中没有iframe,但实际页面包含它

我也尝试过使用urllib2,但它似乎不起作用


有什么问题吗?

您可以从
div
元素中的
noscript
标记中,通过
id=“bookscription\u feature\u div”
获取图书摘要:


谢谢不知道我怎么会错过。
>>> from bs4 import BeautifulSoup
>>> import requests
>>> 
>>> response = requests.get('http://www.amazon.in/Life-What-Make-Preeti-Shenoy/dp/9380349300/ref=sr_1_6?s=books&ie=UTF8&qid=1424652069&sr=1-6',
...                         headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36'})
>>> 
>>> soup = BeautifulSoup(response.content)
>>> print soup.select('div#bookDescription_feature_div noscript')[0].get_text(strip=True)
Ankita Sharma has the world in her palms. She is young, smart and heads turn at every corner she walks by. Born into a conservative middle class household - this defines the chronicle of her life. Set in a time when Doordarshan was the prime source of entertainment and writing love letters was the general fad, every youngster dreams of the thrills of college life. And so, her admission into an MBA institute in Mumbai follows. Ankita's story begins here, from her life as a college student. Life seems all sunshine and flowers until a drastic turn leaves her staring at a disturbing path, only because of her own misdoing. Jump to six months later. The sun glistens on a sombre building. Magnetized in view, the words - “Mental Institute”. Who is the face staring out of the window?What if destiny twisted your journey? What if it dragged you to a place that houses your worst fears? Would you stand and fight or would you run? Set in the late eighties, across two cities, Life is What You Make It is a compelling account of growing up, determination, faith and how an unconquerable spirit can overcome the punches destiny throws at you. At its core, it is a love story that makes us question our identity and the concept of sanity.