Advertisement
Guest User

Untitled

a guest
May 5th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. var request = require('request').defaults({
  2. forever: true,
  3. jar: true,
  4. // 'proxy': 'http://localhost:8888',
  5. headers: {
  6. Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  7. // this should be the link of the ad. instead of NadlanId, use the appropriate ID based on the add.
  8. Referer: 'http://my.yad2.co.il/MyYad2/MyOrder/Yad2Details.php?SalesID=13314637'
  9. }
  10. })
  11.  
  12. //'sign in' to yad2
  13. var res = request.post('http://my.yad2.co.il/newOrder/index.php?action=connect', function optionalCallback(err, httpResponse, body) {
  14. if (err) {
  15. return console.error('connection failed:', err);
  16. }
  17. console.log('Connection successful! now pop up the add');
  18.  
  19. //access the link of the add with Up=u parameter.
  20. request.get('http://my.yad2.co.il/MyYad2/MyOrder/Yad2Details.php?SalesID=13314637&Up=u', function optionalCallback(err, httpResponse, body) {
  21. if (err) {
  22. return console.error('popup first step failed:', err);
  23. }
  24. console.log('popup first step successful!');
  25.  
  26. // aftrer 5 seconds timeout, access the same ad link but with Up=2 instead.
  27. setTimeout(() => {
  28. request.get('http://my.yad2.co.il/MyYad2/MyOrder/Yad2Details.php?Up=2&SalesID=13314637', function optionalCallback(err, httpResponse, body)
  29. {
  30. if (err) {
  31. return console.error('popup second step failed:', err);
  32. }
  33. console.log('popup successful!');
  34. }, 5000)
  35. })
  36.  
  37. })
  38.  
  39. // enter youe username and password here.
  40. }).form({UserName: 'pinski.jenia@gmail.com', password: 'Aa6139490'})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement