Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var request = require('request').defaults({
- forever: true,
- jar: true,
- // 'proxy': 'http://localhost:8888',
- headers: {
- Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
- // this should be the link of the ad. instead of NadlanId, use the appropriate ID based on the add.
- Referer: 'http://my.yad2.co.il/MyYad2/MyOrder/Yad2Details.php?SalesID=13314637'
- }
- })
- //'sign in' to yad2
- var res = request.post('http://my.yad2.co.il/newOrder/index.php?action=connect', function optionalCallback(err, httpResponse, body) {
- if (err) {
- return console.error('connection failed:', err);
- }
- console.log('Connection successful! now pop up the add');
- //access the link of the add with Up=u parameter.
- request.get('http://my.yad2.co.il/MyYad2/MyOrder/Yad2Details.php?SalesID=13314637&Up=u', function optionalCallback(err, httpResponse, body) {
- if (err) {
- return console.error('popup first step failed:', err);
- }
- console.log('popup first step successful!');
- // aftrer 5 seconds timeout, access the same ad link but with Up=2 instead.
- setTimeout(() => {
- request.get('http://my.yad2.co.il/MyYad2/MyOrder/Yad2Details.php?Up=2&SalesID=13314637', function optionalCallback(err, httpResponse, body)
- {
- if (err) {
- return console.error('popup second step failed:', err);
- }
- console.log('popup successful!');
- }, 5000)
- })
- })
- // enter youe username and password here.
- }).form({UserName: 'pinski.jenia@gmail.com', password: 'Aa6139490'})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement