Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. import scrapy
  2.  
  3. form_data = {
  4. 'Host': 'yweb.ymcaboston.org',
  5. 'Connection': 'keep-alive',
  6. 'Content-Length': '162',
  7. 'Cache-Control': 'max-age=0',
  8. 'Origin': 'https://yweb.ymcaboston.org',
  9. 'Upgrade-Insecure-Requests': '1',
  10. 'Content-Type': 'application/x-www-form-urlencoded',
  11. 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36',
  12. 'Sec-Fetch-Dest': 'document',
  13. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
  14. 'Sec-Fetch-Site': 'same-origin',
  15. 'Sec-Fetch-Mode': 'navigate',
  16. 'Sec-Fetch-User': '?1',
  17. 'Referer': 'https://yweb.ymcaboston.org/SpiritWeb/SearchClass',
  18. 'Accept-Encoding': 'gzip, deflate, br',
  19. 'Accept-Language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
  20. 'Cookie': 'JSESSIONID=B3EA74E806326E6A103E6AF6B4183B1D; _gcl_au=1.1.1607218088.1581862558; _ga=GA1.2.1529164039.1581862559; _gid=GA1.2.1585617269.1581862559; _fbp=fb.1.1581862558831.182947883; comm100_visitorguid_230425=1ae2a14b-d49a-45fc-806b-02d55c80e3c2; _gat_gtag_UA_119444777_1=1; _gat_UA-154305703-1=1'
  21. }
  22.  
  23.  
  24. class MachineSpider(scrapy.Spider):
  25. name = 'api'
  26. start_urls = ['https://yweb.ymcaboston.org/SpiritWeb/SearchClass']
  27.  
  28. def start_requests(self):
  29. yield scrapy.FormRequest('https://yweb.ymcaboston.org/SpiritWeb/SearchClass',
  30. formdata={'EXECEVENT': 'ONSEARCH', 'SORTBY': 'AGE'},
  31. headers=form_data,
  32. callback=self.parse)
  33.  
  34.  
  35. def parse(self, response):
  36. print(response.body)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement