instaman 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/instaman/version.rb +1 -1
- data/lib/instaman.rb +83 -1
- metadata +1 -8
- data/.gitignore +0 -9
- data/Gemfile +0 -5
- data/README.md +0 -80
- data/Rakefile +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/instaman.gemspec +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 601ddb58a519b21a92f00b68f8b6498a8fb7423c
|
4
|
+
data.tar.gz: fce402035ea0de0e1851fa379d0b22392a513fdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee3b9e26eefef40d1fbc499b6dc9457a06c3d28d78f33673ab080481d9accf474ece26284c101dcb67ebcdea9472cc09f13b602bcfbdcc7f71ee2e2ae461ba1
|
7
|
+
data.tar.gz: 8954bd036793209d72bf14a7c6f7608efef6b329e55e1717a8d9f654f4def41a3427e50433458429c055ff9f869d0959044542cf9118da4b266c406d4a0dd18f
|
data/lib/instaman/version.rb
CHANGED
data/lib/instaman.rb
CHANGED
@@ -1,5 +1,87 @@
|
|
1
1
|
require "instaman/version"
|
2
|
-
require
|
2
|
+
require "watir"
|
3
3
|
module Instaman
|
4
|
+
class Bot
|
5
|
+
def initialize(username,password,hashtags,comments)
|
6
|
+
$username=username
|
7
|
+
$password=password
|
8
|
+
$hashtags_initial=hashtags
|
9
|
+
$comments_initial=comments
|
10
|
+
end
|
11
|
+
def enter_account
|
4
12
|
|
13
|
+
#Open a new chrome browser
|
14
|
+
browser = Watir::Browser.new :chrome, headless:true
|
15
|
+
browser.goto "http://instagram.com/accounts/login/"
|
16
|
+
|
17
|
+
#Fill the form and click login button
|
18
|
+
browser.text_field(:name, 'username').set "#{$username}"
|
19
|
+
sleep(2)
|
20
|
+
browser.text_field(:name, 'username').set "#{$password}"
|
21
|
+
sleep(5)
|
22
|
+
if browser.button(class: ['_qv64e' , '_gexxb' , '_4tgw8' , '_njrw0']).exists?
|
23
|
+
browser.button(class: ['_qv64e' , '_gexxb' , '_4tgw8' , '_njrw0']).click
|
24
|
+
else
|
25
|
+
sleep(1)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
def bot
|
29
|
+
|
30
|
+
$hashtags=$hashtags_initial.split(',')
|
31
|
+
$comments=comments_initial.split(',')
|
32
|
+
|
33
|
+
$hashtags.each do |i|
|
34
|
+
|
35
|
+
#Open discover page for hashtag
|
36
|
+
browser.goto "https://instagram.com/tags/#{i}"
|
37
|
+
puts "Discover page opened for" + " " + i
|
38
|
+
|
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|
|
41
|
+
divs.a.click
|
42
|
+
sleep(1)
|
43
|
+
if browser.span(:class, ['_8scx2' , 'coreSpriteHeartOpen']).exists?
|
44
|
+
browser.span(:class, ['_8scx2' , 'coreSpriteHeartOpen']).click
|
45
|
+
else sleep(1)
|
46
|
+
end
|
47
|
+
sleep(2)
|
48
|
+
if browser.button(:class, ['_qv64e' , '_iokts' , '_4tgw8' , '_njrw0']).exists?
|
49
|
+
browser.button(:class, ['_qv64e' , '_iokts' , '_4tgw8' , '_njrw0']).click
|
50
|
+
|
51
|
+
#Take username
|
52
|
+
user_name=browser.link(:class, ['_2g7d5' , 'notranslate' , '_iadoq']).text
|
53
|
+
|
54
|
+
#Add to array
|
55
|
+
$follow << user_name
|
56
|
+
|
57
|
+
#Type to comand line
|
58
|
+
puts user_name + " followed at "
|
59
|
+
else sleep(2)
|
60
|
+
end
|
61
|
+
sleep(rand(50..70))
|
62
|
+
browser.back
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
def unfollow
|
68
|
+
$follow.each do |f|
|
69
|
+
browser.goto "http://instagram.com/#{f}"
|
70
|
+
sleep(2)
|
71
|
+
if browser.button(:class, ['_qv64e', '_t78yp' , '_r9b8f' , '_njrw0']).exists?
|
72
|
+
browser.button(:class, ['_qv64e', '_t78yp' , '_r9b8f' , '_njrw0']).click
|
73
|
+
|
74
|
+
#Type unfollowed people
|
75
|
+
puts "You unfollowed " + f
|
76
|
+
|
77
|
+
#Wait random time
|
78
|
+
sleep(rand(50..70))
|
79
|
+
browser.back
|
80
|
+
else
|
81
|
+
sleep(2)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
$follow.clear
|
85
|
+
end
|
86
|
+
end
|
5
87
|
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.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hasan kursun
|
@@ -75,13 +75,6 @@ executables: []
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
-
- ".gitignore"
|
79
|
-
- Gemfile
|
80
|
-
- README.md
|
81
|
-
- Rakefile
|
82
|
-
- bin/console
|
83
|
-
- bin/setup
|
84
|
-
- instaman.gemspec
|
85
78
|
- lib/instaman.rb
|
86
79
|
- lib/instaman/version.rb
|
87
80
|
homepage: http://github.com/hasannkursunn/instaman
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
# Instaman
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/instaman`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
Instaman is a gem to increase interaction of your Instagram account and increase the number of followers. It visits the latest posts and likes. Follows the owner and unfollows the user after certain number of loops.You can help to develop a comment part and integrate to gem. Since I do not want anyone to be banned I did not include a random commenting part. I want it to be smart as possible. You can fork and develop project and contact me by using Instagram. My username is @hasannkursunn . I would love to interact with you.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'instaman'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install instaman
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
Create a new empty array:
|
26
|
-
```ruby
|
27
|
-
follow=[""]
|
28
|
-
```
|
29
|
-
|
30
|
-
Then create a new object for Instaman:
|
31
|
-
```ruby
|
32
|
-
profile = Instaman::Bot.new("YOUR USERNAME GOES HERE" , "YOUR PASSWORD GOES HERE" , "YOUR HASHTAGS GOES HERE WİTH JUST COMMA", "THİS PART FOR COMMENTS BUT THE FEATURE IS NOT ACTIVE YET")
|
33
|
-
```
|
34
|
-
|
35
|
-
Then use methods:
|
36
|
-
```ruby
|
37
|
-
#For Entering account
|
38
|
-
profile.enter_account
|
39
|
-
|
40
|
-
#For running bot
|
41
|
-
profile.bot
|
42
|
-
|
43
|
-
#For running unfollow part
|
44
|
-
profile.unfollow
|
45
|
-
|
46
|
-
```
|
47
|
-
|
48
|
-
The gem was designed to wait enough time after each action. The best thing you can do is to add rescue command as mentioned below and run loop for bot:
|
49
|
-
```ruby
|
50
|
-
#Start loop
|
51
|
-
loop do
|
52
|
-
#Runs follow part for 16 times
|
53
|
-
begin
|
54
|
-
16.times do
|
55
|
-
profile.bot
|
56
|
-
end
|
57
|
-
rescue Watir::Exception::UnknownObjectException #in case it gives an error
|
58
|
-
sleep(40)
|
59
|
-
end
|
60
|
-
|
61
|
-
#Runs unfollow part
|
62
|
-
begin
|
63
|
-
profile.unfollow
|
64
|
-
rescue Watir::Exception::UnknownObjectException #in case it gives an error
|
65
|
-
sleep(40)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
```
|
70
|
-
|
71
|
-
The bot can run days or weeks until you stop it with this way. Please help to improve it. Fork it and give it a star. I will be very appriciated if you contact me with my Instagram account @hasannkursunn . Find me and contact me and lets make something beautifull together.
|
72
|
-
## Development
|
73
|
-
|
74
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
75
|
-
|
76
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
77
|
-
|
78
|
-
## Contributing
|
79
|
-
|
80
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/hasannkursunn/instaman.
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "instaman"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/instaman.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "instaman/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "instaman"
|
8
|
-
spec.version = Instaman::VERSION
|
9
|
-
spec.authors = ["hasan kursun"]
|
10
|
-
spec.email = ["kursunhasan97@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Instaman gem is used to increase the number of followers on Instagram.}
|
13
|
-
spec.description = %q{The Instaman gem interacts with the latest posts on the Instagram according to hashtags that you choose. It likes, follows and unfollows photos and users. Give me feedback and contact me via Instagram with @hasannkursunn username. }
|
14
|
-
spec.homepage = "http://github.com/hasannkursunn/instaman"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
-
end
|
19
|
-
spec.bindir = "exe"
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.15"
|
24
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency "watir", "~> 5.0"
|
26
|
-
spec.add_development_dependency "chromedriver-helper", "~> 1.2"
|
27
|
-
end
|