Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. import scrapy
  2. from scrapy.http import FormRequest
  3.  
  4.  
  5. class MygoferDSpider(scrapy.Spider):
  6. name = "mygofer_d"
  7. allowed_domains = ["mygofer.com"]
  8. start_urls = ['https://www.mygofer.com/furniture/b-34790/rowCount_120?keyword=south%20shore%20furniture']
  9.  
  10.  
  11. def start_requests(self):
  12. return[FormRequest("https://www.mygofer.com/lps-mygofer/api/v1/mygofer/search",
  13. formdata = '''{"filters":{},
  14. "brandFilter":"null",
  15. "sellersFilter":"null",
  16. "catgroupId":"34790",
  17. "levelOne":"null",
  18. "searchMode":"BROWSE",
  19. "sortBy":"RECOMMENDED",
  20. "keyword":"south%20shore%20furniture",
  21. "pageNum":"1",
  22. "rowCount":"120",
  23. "ffmMode":"ALL",
  24. "priceFilter":"null",
  25. "hideOOS":"true",
  26. "uNo":"4848",
  27. "session":{"guid":"0",
  28. "emailId":"",
  29. "sessionKey":"fcd3bcd1-b7bf-11e6-8e27-00505699251d",
  30. "userId":"5970776",
  31. "appId":"MYGOFER"},
  32. "security":{"src":"web",
  33. "ts":"2016-12-01T12:58:28.994Z",
  34. "authToken":""}}''',
  35. callback=self.parse)]
  36.  
  37. handle_httpstatus_list = [415]
  38. def parse(self, response):
  39. print "+++++", response.url
  40. with open("mygofer.txt","wb") as v:
  41. v.write(response.body)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement