shotter 0.0.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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +28 -0
- data/Rakefile +2 -0
- data/bin/shotter +44 -0
- data/lib/shotter.rb +5 -0
- data/lib/shotter/version.rb +3 -0
- data/shotter.gemspec +19 -0
- metadata +67 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Henare Degan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Shotter
|
2
|
+
|
3
|
+
Bulk screenshot a list of websites
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install shotter
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
`shotter site_list.txt`
|
12
|
+
|
13
|
+
site_list.txt must contain a list of URLs you want to capture with each site
|
14
|
+
on a new line, e.g.
|
15
|
+
|
16
|
+
http://google.com
|
17
|
+
http://yahoo.com
|
18
|
+
https://duckduckgo.com/privacy.html
|
19
|
+
|
20
|
+
Screenshots will be saved to the current directory as PNGs.
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/shotter
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
if ARGV.first.nil?
|
3
|
+
puts <<-EOF
|
4
|
+
Shotter: Bulk screenshot a list of websites
|
5
|
+
|
6
|
+
Usage: shotter site_list.txt
|
7
|
+
|
8
|
+
site_list.txt must contain a list of URLs you want to capture with each site
|
9
|
+
on a new line, e.g.
|
10
|
+
|
11
|
+
http://google.com
|
12
|
+
http://yahoo.com
|
13
|
+
https://duckduckgo.com/privacy.html
|
14
|
+
|
15
|
+
Screenshots will be saved to the current directory as PNGs.
|
16
|
+
|
17
|
+
EOF
|
18
|
+
exit false
|
19
|
+
end
|
20
|
+
|
21
|
+
site_list = File.open(ARGV.first)
|
22
|
+
|
23
|
+
require 'selenium-webdriver'
|
24
|
+
|
25
|
+
puts "Loading Firefox..."
|
26
|
+
driver = Selenium::WebDriver.for(:firefox)
|
27
|
+
|
28
|
+
# Resize to a generally good size
|
29
|
+
driver.manage.window.resize_to "1280", "960"
|
30
|
+
|
31
|
+
site_list.lines.each do |l|
|
32
|
+
# Get rid of newlines and add http if we need to
|
33
|
+
site = (l[URI::regexp(%w(http https))] ? l : "http://#{l}").strip
|
34
|
+
filename = site.downcase.gsub(/https?:\/\//,'').gsub(/\//, '_').gsub(/[^0-9A-za-z.]/,'') + ".png"
|
35
|
+
if File.exists? filename
|
36
|
+
puts "Skipping already saved site #{site}"
|
37
|
+
next
|
38
|
+
end
|
39
|
+
puts "Screenshotting #{site}"
|
40
|
+
driver.get site
|
41
|
+
driver.save_screenshot filename
|
42
|
+
end
|
43
|
+
|
44
|
+
driver.close
|
data/lib/shotter.rb
ADDED
data/shotter.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/shotter/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Henare Degan"]
|
6
|
+
gem.email = ["henare.degan@gmail.com"]
|
7
|
+
gem.description = %q{Bulk screenshot a list of websites}
|
8
|
+
gem.summary = %q{Takes a list of URLs from a file and saves PNG screenshots of each site into the current directory.}
|
9
|
+
gem.homepage = "https://github.com/henare/shotter"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "shotter"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Shotter::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "selenium-webdriver"
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shotter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Henare Degan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-20 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: selenium-webdriver
|
16
|
+
requirement: &15065140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *15065140
|
25
|
+
description: Bulk screenshot a list of websites
|
26
|
+
email:
|
27
|
+
- henare.degan@gmail.com
|
28
|
+
executables:
|
29
|
+
- shotter
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- bin/shotter
|
39
|
+
- lib/shotter.rb
|
40
|
+
- lib/shotter/version.rb
|
41
|
+
- shotter.gemspec
|
42
|
+
homepage: https://github.com/henare/shotter
|
43
|
+
licenses: []
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.8.10
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Takes a list of URLs from a file and saves PNG screenshots of each site into
|
66
|
+
the current directory.
|
67
|
+
test_files: []
|