BeautifulSoup无法读取元素

时间:2018-08-19 08:04:30

标签: python-3.x web-scraping

我正在尝试从https://www.yelp.com抓取数据。 以下是yelp.com的链接

https://www.yelp.com/adredir?ad_business_id=9loHqjf1yIWv27Jowkymhg&campaign_id=-Fo9UnT0LE3bWCph6c32fA&click_origin=search_results&placement=above_search&redirect_url=https%3A%2F%2Fwww.yelp.com%2Fbiz%2Fdennys-orlando-4&request_id=709bf3cd865829d4&signature=7e7c9168ba838dca1e40b0f48e8e91b2b3e05123488ee1e2da3732ee8fbd1ca9&slot=0

上述链接重定向到

https://www.yelp.com/biz/dennys-orlando-4

我猜是由于我的代码失败。

` my_web_page = requests.get(value["shop_full_url"])
  my_soup = BeautifulSoup(my_web_page.text, 'html.parser')
  comment_pages_list = my_soup.findAll(class_="page-of-pages")
  for comment_pages in comment_pages_list:
        print(comment_pages.text.strip().replace("Page 1 of ", "")

0 个答案:

没有答案