Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9077611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:24:37+00:00 2026-06-16T19:24:37+00:00

I am using this scrapy code snippet to render javascript code of the website

  • 0

I am using this scrapy code snippet to render javascript code of the website that I want to crawl data from. The site is a video search engine and the search results is rendered by javascript. I want to follow the next page link and scrap the whole searched items. Following is my spider code:

class VideoSpider(BaseSpider):
    name = "VideoSpider"
    allowed_domains = ["domain.com"]
    start_urls = ['video search results link']

    def parse(self, response):
        hxs = HtmlXPathSelector(response)
        video_items = hxs.select("//ul[@id='results-list']/li[@class='result']")
        #items = []
        for vi in video_items:
            item = VideoItem()
            link = vi.select("a[@class='result-link']/@href").extract()[0]
            title = vi.select("a[@class='result-link']/@title").extract()[0]
            #print title,link
            item['title'] = title
            item['url'] = link
            yield item

        next_page = hxs.select("//div[@id='page']/a")
        for np in next_page:
            next_url = np.select("@href").extract()
            if next_url:
                url = urlparse.urljoin(response.url, next_url[0])
                #url = response.url, str(next_page)
                self.log("find next page url: %s"%url, log.INFO)
                yield Request(url, callback=self.parse)

I found that the link in the start_urls is correctly downloaded and rendered properly like this:

<ul id="results-list" class="clearfix" static="bl=normal">
    <li class="result" href="" </li>
     <li class="result" href="" </li>
     <li class="result" href="" </li>
    ....

Therefore the extracting is successful on the first page while when the next page links is fetched the javascript is not rendered like this:

<ul id="results-list" class="clearfix" static="bl=normal"></ul>
    <div id="loading">trying to load page for you, please be patient</div>

So the scraping stopped because it can not extract the links as a result of the results-list is not rendered.Why the first page is rendered properly but the second is not? Should I use selenium instead of webkit and jswebkit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:24:39+00:00Added an answer on June 16, 2026 at 7:24 pm

    Finally I figure out the problem. Some url are not properly formed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using javascript, using regex to scrape images from html code. I want
Using this piece of code in the head of a page: <script type=text/javascript> function
I am using below reffered code to scrape some item names from a site:
I'm trying to scrape the price field from this website using the HTML Agility
i am trying to scrape some data from this site : http://laperuanavegana.wordpress.com/ . actually
I did scraping text from webpage using scrapy. In spider, I have code like:
I'm using scrapy and I'm trying to save the scraped data from a spider
I am using beautiful soup to scrape some data from a website but I
Trying to install Scrapy on Mac OSX 10.6 using this guide : When running
Using this C# application pick a start and ending date range, that SAP will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.