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 8141203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:25:37+00:00 2026-06-06T12:25:37+00:00

I’m new with using scrapy and i’m trying to get some info from a

  • 0

I’m new with using scrapy and i’m trying to get some info from a real estate website.
The site has a home page with a search form (method GET).
I’m trying to go to the results page in my start_requests (recherche.php), and setting all the get parameters i see in the address bar in the formdata parameter.
I also set up the cookies i had, but he didn’t work either..

Here’s my spider:

from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import FormRequest, Request

from robots_immo.items import AnnonceItem

class ElyseAvenueSpider(BaseSpider):
    name = "elyse_avenue"
    allowed_domains = ["http://www.elyseavenue.com/"]

    def start_requests(self):
        return [FormRequest(url="http://www.elyseavenue.com/recherche.php",
                            formdata={'recherche':'recherche',
                                      'compteurLigne':'2',
                                      'numLigneCourante':'0',
                                      'inseeVille_0':'',
                                      'num_rubrique':'',
                                      'rechercheOK':'recherche',
                                      'recherche_budget_max':'',
                                      'recherche_budget_min':'',
                                      'recherche_surface_max':'',
                                      'recherche_surface_min':'',
                                      'recherche_distance_km_0':'20',
                                      'recherche_reference_bien':'',
                                      'recherche_type_logement':'9',
                                      'recherche_ville_0':''
                                     },
                            cookies={'PHPSESSID':'4e1d729f68d3163bb110ad3e4cb8ffc3',
                                     '__utma':'150766562.159027263.1340725224.1340725224.1340727680.2',
                                     '__utmc':'150766562',
                                     '__utmz':'150766562.1340725224.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
                                     '__utmb':'150766562.14.10.1340727680'
                                    },
                            callback=self.parseAnnonces
                           )]



    def parseAnnonces(self, response):
        hxs = HtmlXPathSelector(response)
        annonces = hxs.select('//div[@id="contenuCentre"]/div[@class="blocVignetteBien"]')
        items = []
        for annonce in annonces:
            item = AnnonceItem()
            item['nom'] = annonce.select('span[contains(@class,"nomBienImmo")]/a/text()').extract()
            item['superficie'] = annonce.select('table//tr[2]/td[2]/span/text()').extract()
            item['prix'] = annonce.select('span[@class="prixVignette"]/span[1]/text()').extract()
            items.append(item)
        return items


SPIDER = ElyseAvenueSpider()

When i run the spider, there is no problem, but the page loaded is not the good one (it’s saying “Please specify your search” and i don’t get any results..)

2012-06-26 20:04:54+0200 [elyse_avenue] INFO: Spider opened
2012-06-26 20:04:54+0200 [elyse_avenue] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2012-06-26 20:04:54+0200 [scrapy] DEBUG: Telnet console listening on 0.0.0.0:6023
2012-06-26 20:04:54+0200 [scrapy] DEBUG: Web service listening on 0.0.0.0:6080
2012-06-26 20:04:54+0200 [elyse_avenue] DEBUG: Crawled (200) <POST http://www.elyseavenue.com/recherche.php> (referer: None)
2012-06-26 20:04:54+0200 [elyse_avenue] INFO: Closing spider (finished)
2012-06-26 20:04:54+0200 [elyse_avenue] INFO: Dumping spider stats:
    {'downloader/request_bytes': 808,
     'downloader/request_count': 1,
     'downloader/request_method_count/POST': 1,
     'downloader/response_bytes': 7590,
     'downloader/response_count': 1,
     'downloader/response_status_count/200': 1,
     'finish_reason': 'finished',
     'finish_time': datetime.datetime(2012, 6, 26, 18, 4, 54, 924624),
     'scheduler/memory_enqueued': 1,
     'start_time': datetime.datetime(2012, 6, 26, 18, 4, 54, 559230)}
2012-06-26 20:04:54+0200 [elyse_avenue] INFO: Spider closed (finished)
2012-06-26 20:04:54+0200 [scrapy] INFO: Dumping global stats:
    {'memusage/max': 27410432, 'memusage/startup': 27410432}

Thanks for your help !

  • 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-06T12:25:38+00:00Added an answer on June 6, 2026 at 12:25 pm

    I would use FormRequest.from_response() which does all the job for you, as you could still miss some fields:

    from scrapy.spider import BaseSpider
    from scrapy.selector import HtmlXPathSelector
    from scrapy.http import FormRequest, Request
    
    from robots_immo.items import AnnonceItem
    
    class ElyseAvenueSpider(BaseSpider):
    
        name = "elyse_avenue"
        allowed_domains = ["elyseavenue.com"] # i fixed this
        start_urls = ["http://www.elyseavenue.com/"] # i added this
    
        def parse(self, response):
            yield FormRequest.from_response(response, formname='moteurRecherche', formdata={'recherche_distance_km_0':'20', 'recherche_type_logement':'9'}, callback=self.parseAnnonces)
    
        def parseAnnonces(self, response):
            hxs = HtmlXPathSelector(response)
            annonces = hxs.select('//div[@id="contenuCentre"]/div[@class="blocVignetteBien"]')
            items = []
            for annonce in annonces:
                item = AnnonceItem()
                item['nom'] = annonce.select('span[contains(@class,"nomBienImmo")]/a/text()').extract()
                item['superficie'] = annonce.select('table//tr[2]/td[2]/span/text()').extract()
                item['prix'] = annonce.select('span[@class="prixVignette"]/span[1]/text()').extract()
                items.append(item)
            return items
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.