Python Forum
Python - Scrapy Javascript Pagination (next_page)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python - Scrapy Javascript Pagination (next_page)
#1
Hello guys...i made this script for this website....but my pagination doesn't work because its just javascript...and when you click nextpage the container loads new data....
i did found the urls for the naxt pages, here's some examples:

Page2
Page3

But im getting the results from the first page only....:/

code:
# -*- coding: utf-8 -*-
import scrapy
import time
 
class SiriosbotSpider(scrapy.Spider):
    name = 'SiriosBot'
    start_urls = ['https://www.siriocenter.gr/Proionta/Mpoulonia-ApostatesTroxwn']
    def parse(self, response):
        for content in response.css('div.resultItemTxt'):
            item = {
            'Title' : content.css('th[colspan="2"] > a::text').extract(),
            'Price' : content.css('div.price > span::text').extract(),
            'Manufacture' : content.css('tr:nth-child(2)').extract(),
            'Model' : content.css('tr:nth-child(3)').extract(),
            'Eidos' : content.css('tr:nth-child(4)').extract(),
            'Typos' : content.css('tr:nth-child(5)').extract(),
            'Kare' : content.css('tr:nth-child(6)').extract(),
            'Comments' : content.css('tr:nth-child(7)').extract(),
            'ProductLink' : content.css('th[colspan="2"] > a::attr(href)').extract(),
            'Img' : content.css('div.resultItemImage > a').extract(),
            'CurrentURL' : response.url
            }
            yield item
 
        for next_page in response.css('div.paging > a:last-child::attr(href)'):
            url = response.urljoin(next_page.extract())
            yield scrapy.Request(url, self.parse)
Thank you! :D
Reply


Messages In This Thread
Python - Scrapy Javascript Pagination (next_page) - by Baggelhsk95 - Oct-08-2018, 09:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BeautifulSoup pagination using href rhat398 1 2,482 Jun-30-2021, 10:55 AM
Last Post: snippsat
  Using Python request without selenium on html form with javascript onclick submit but eraosa 0 3,264 Jan-09-2021, 06:08 PM
Last Post: eraosa
  Python Scrapy Date Extraction Issue tr8585 1 3,472 Aug-05-2020, 04:32 AM
Last Post: tr8585
  Python Scrapy tr8585 2 2,467 Aug-04-2020, 04:11 AM
Last Post: tr8585
  question about using javascript on python selenium Kai 1 1,963 Apr-12-2020, 04:28 AM
Last Post: Larz60+
  Python beautifulsoup pagination error The61 5 3,580 Apr-09-2020, 09:17 PM
Last Post: Larz60+
  Pagination prejni 2 2,491 Nov-18-2019, 10:45 AM
Last Post: alekson
  Scrapy Javascript Pagination (next_page) nazmulfinance 2 3,161 Nov-18-2019, 01:01 AM
Last Post: nazmulfinance
  the next_page command using Scrapy Splash is not working nazmulfinance 0 2,135 Nov-16-2019, 03:47 PM
Last Post: nazmulfinance
  pagination for non standarded pages zarize 12 6,251 Sep-02-2019, 12:35 PM
Last Post: zarize

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020