Bottom Page

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Scraping not moving to the next pages in a website
I am trying to scrape a website with all the succeeding pages in it. But after the second page, it is repeating itself indefinitely with output from just the second page. What went wrong here? I am not getting any error message. It is continuously scraping just the second page.

from bs4 import BeautifulSoup
import requests
import pandas as pd
while True:
    response= requests.get(url)
    soup= BeautifulSoup(data,'html.parser') 

    for api in apis:
        name_tag= api.find('td',{"class":"views-field views-field-pw-version-title"})
        name=name_tag.text if name_tag else 'na'
        des_tag=api.find('td',{'class':'views-field views-field-search-api-excerpt views-field-field-api-description hidden-xs visible-md visible-sm col-md-8'})
        des=des_tag.text if des_tag else 'na'
        category_tag=api.find('td',{'class':'views-field views-field-field-article-primary-category'})
        category=category_tag.text if category_tag else 'na'
        link_tag= api.find('a',{'class':'views-field views-field-pw-version-title'})
        link=link_tag.get('href') if link_tag else 'na'
        print('Name:',name,'\nDescription:', des ,'\nCategory:', category ,'\nLink:', link)
    url_tag=soup.find('a',{'title':'Go to next page'})
    if url_tag.get('href'):
apollo likes this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  scraping from a website that hides source code PIWI_Protein 1 92 Mar-27-2020, 05:08 PM
Last Post: Larz60+
  Scrapping javascript website with Selenium where pages randomly fail to load JuanJuan 14 734 Dec-27-2019, 12:32 PM
Last Post: JuanJuan
  Random Loss of Control of Website When Scraping bmccollum 0 218 Aug-30-2019, 04:04 AM
Last Post: bmccollum
  MaxRetryError while scraping a website multiple times kawasso 6 3,495 Aug-29-2019, 05:25 PM
Last Post: kawasso
  Scraping external URLs from pages Apook 5 1,419 Jul-18-2018, 06:42 PM
Last Post: nilamo
  scraping multiple pages of a website. Blue Dog 14 13,689 Jun-21-2018, 09:03 PM
Last Post: Blue Dog
  Scraping number in % from website santax 3 2,119 Mar-19-2017, 12:22 PM
Last Post: santax

Forum Jump:

Users browsing this thread: 1 Guest(s)