instaman 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60c3b6d24824b5844d2932a3d348b938368383f4
4
- data.tar.gz: 45e692b74da4f8331a10d3d794a3b50354790561
3
+ metadata.gz: f1a1de39aafd963bfdc5257243c075bb67efddb1
4
+ data.tar.gz: a27a20f63115d3f44741ae4e7ca5d76a0ded8071
5
5
  SHA512:
6
- metadata.gz: 3c0cd9f69320cbf4288d5f70d003535b0b0a7f225abfe37b6be69b9735941bd5753bb3684dd2f93cba13c35125a279ca61b7bc3c95056bfc5db12feda6fd9ecf
7
- data.tar.gz: 421b9ec25ba43b90e638353396ddf045cbcd685617009ddfd94b90637ba7da85578135587ef1e42a680d89a2e78ec7eb7dde17b4bb874ced90ae7c728f063fbd
6
+ metadata.gz: fdc7a74b4dac305ce36c106ec73c88aaffb04482c828908519543126eabd5a6c205ee7feed85192c906f4aa18d4b7d4330db525fff3713e201c0042f5e3c0481
7
+ data.tar.gz: 67bd7f6a28b2987b39126ad5b40c84ff08456747b0852277fbbca7f77014d6a87d18489533815e0a907fdf89c6cb3be90444b27d67a1a590b242dd3c8e32b14f
@@ -1,3 +1,3 @@
1
1
  module Instaman
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/instaman.rb CHANGED
@@ -10,17 +10,17 @@ class Bot
10
10
  end
11
11
  def enter_account
12
12
 
13
- #Open a new chrome browser
14
- browser = Watir::Browser.new :chrome, headless:true
15
- browser.goto "http://instagram.com/accounts/login/"
13
+ #Open a new chrome $browser
14
+ $browser = Watir::Browser.new :chrome, headless:true
15
+ $browser.goto "http://instagram.com/accounts/login/"
16
16
 
17
17
  #Fill the form and click login button
18
- browser.text_field(:name, 'username').set "#{$username}"
18
+ $browser.text_field(:name, 'username').set "#{$username}"
19
19
  sleep(2)
20
- browser.text_field(:name, 'username').set "#{$password}"
20
+ $browser.text_field(:name, 'username').set "#{$password}"
21
21
  sleep(5)
22
- if browser.button(class: ['_qv64e' , '_gexxb' , '_4tgw8' , '_njrw0']).exists?
23
- browser.button(class: ['_qv64e' , '_gexxb' , '_4tgw8' , '_njrw0']).click
22
+ if $browser.button(class: ['_qv64e' , '_gexxb' , '_4tgw8' , '_njrw0']).exists?
23
+ $browser.button(class: ['_qv64e' , '_gexxb' , '_4tgw8' , '_njrw0']).click
24
24
  else
25
25
  sleep(1)
26
26
  end
@@ -33,23 +33,23 @@ class Bot
33
33
  $hashtags.each do |i|
34
34
 
35
35
  #Open discover page for hashtag
36
- browser.goto "https://instagram.com/tags/#{i}"
36
+ $browser.goto "https://instagram.com/tags/#{i}"
37
37
  puts "Discover page opened for" + " " + i
38
38
 
39
39
  #Click newest 4 pictures on the page
40
- browser.div(:xpath, '//*[@id="react-root"]/section/main/article/div[2]').divs(:class, ['_mck9w', '_gvoze', '_tn0ps']).first(4).each do |divs|
40
+ $browser.div(:xpath, '//*[@id="react-root"]/section/main/article/div[2]').divs(:class, ['_mck9w', '_gvoze', '_tn0ps']).first(4).each do |divs|
41
41
  divs.a.click
42
42
  sleep(1)
43
- if browser.span(:class, ['_8scx2' , 'coreSpriteHeartOpen']).exists?
44
- browser.span(:class, ['_8scx2' , 'coreSpriteHeartOpen']).click
43
+ if $browser.span(:class, ['_8scx2' , 'coreSpriteHeartOpen']).exists?
44
+ $browser.span(:class, ['_8scx2' , 'coreSpriteHeartOpen']).click
45
45
  else sleep(1)
46
46
  end
47
47
  sleep(2)
48
- if browser.button(:class, ['_qv64e' , '_iokts' , '_4tgw8' , '_njrw0']).exists?
49
- browser.button(:class, ['_qv64e' , '_iokts' , '_4tgw8' , '_njrw0']).click
48
+ if $browser.button(:class, ['_qv64e' , '_iokts' , '_4tgw8' , '_njrw0']).exists?
49
+ $browser.button(:class, ['_qv64e' , '_iokts' , '_4tgw8' , '_njrw0']).click
50
50
 
51
51
  #Take username
52
- user_name=browser.link(:class, ['_2g7d5' , 'notranslate' , '_iadoq']).text
52
+ user_name=$browser.link(:class, ['_2g7d5' , 'notranslate' , '_iadoq']).text
53
53
 
54
54
  #Add to array
55
55
  $follow << user_name
@@ -59,24 +59,24 @@ class Bot
59
59
  else sleep(2)
60
60
  end
61
61
  sleep(rand(50..70))
62
- browser.back
62
+ $browser.back
63
63
  end
64
64
 
65
65
  end
66
66
  end
67
67
  def unfollow
68
68
  $follow.each do |f|
69
- browser.goto "http://instagram.com/#{f}"
69
+ $browser.goto "http://instagram.com/#{f}"
70
70
  sleep(2)
71
- if browser.button(:class, ['_qv64e', '_t78yp' , '_r9b8f' , '_njrw0']).exists?
72
- browser.button(:class, ['_qv64e', '_t78yp' , '_r9b8f' , '_njrw0']).click
71
+ if $browser.button(:class, ['_qv64e', '_t78yp' , '_r9b8f' , '_njrw0']).exists?
72
+ $browser.button(:class, ['_qv64e', '_t78yp' , '_r9b8f' , '_njrw0']).click
73
73
 
74
74
  #Type unfollowed people
75
75
  puts "You unfollowed " + f
76
76
 
77
77
  #Wait random time
78
78
  sleep(rand(50..70))
79
- browser.back
79
+ $browser.back
80
80
  else
81
81
  sleep(2)
82
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instaman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - hasan kursun