gphotos 0.1.2 → 0.1.3
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/README.md +2 -2
- data/lib/gphotos/app.rb +1 -1
- data/lib/gphotos/gphotos.rb +3 -15
- data/lib/gphotos/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ebeab76559bd4ed56947ad1117d3e208764625e8
|
|
4
|
+
data.tar.gz: ccf6ae3c3950723f4d03a0eee00e88fade105668
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48342084ba713b7efa7f736a64e71ac4ecfe12668ac24675f2c7de7aa6173b684ac8750c8ac2924c36c4174ffba6f40c50de3a2cfbdca70830c0e5f2cfca83ea
|
|
7
|
+
data.tar.gz: 916aa16a1d812bee7792c8ad87b04b975fb47d46ad9ff507773c3290efbf65fbc1022c954e95f01deb1a92b8f3a581a148a789d25315bdf28d9e5649687ff7af
|
data/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Example:
|
|
|
50
50
|
0 skipped
|
|
51
51
|
0 not exist
|
|
52
52
|
|
|
53
|
-
Set email and password in config file, `~/.gphotos.yml`:
|
|
53
|
+
Set email and password in config file, `~/.gphotos/config.yml`:
|
|
54
54
|
|
|
55
55
|
:email: foo@gmail.com
|
|
56
56
|
:passwd: foo
|
|
@@ -59,7 +59,7 @@ If you use password managers like [pass](https://www.passwordstore.org/), you ca
|
|
|
59
59
|
|
|
60
60
|
:passwd_exec: pass show foo@gmail.com
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
ChromeDriver user data(browser settings, cookies, cache) will be saved in `~/.gphotos/chromedriver`, so you don't need to login every time. If you encounter any browser related problem, remove the user data directory and retry.
|
|
63
63
|
|
|
64
64
|
## Development
|
|
65
65
|
|
data/lib/gphotos/app.rb
CHANGED
data/lib/gphotos/gphotos.rb
CHANGED
|
@@ -6,26 +6,15 @@ module Gphotos
|
|
|
6
6
|
|
|
7
7
|
def initialize(email, passwd, passwd_exec, options = {})
|
|
8
8
|
options = {:page_timeout => 20, :upload_timeout => 7200 }.merge(options)
|
|
9
|
-
|
|
10
|
-
profile
|
|
11
|
-
@driver = Selenium::WebDriver.for(:chrome, :
|
|
9
|
+
user_data_dir = File.expand_path('~/.gphotos/chromedriver')
|
|
10
|
+
prefs = {"profile" => {"managed_default_content_settings" => {"images" => 2}}}
|
|
11
|
+
@driver = Selenium::WebDriver.for(:chrome, :args => ["--user-data-dir=#{user_data_dir}"], :prefs => prefs)
|
|
12
12
|
@driver.manage.timeouts.implicit_wait = options[:page_timeout]
|
|
13
13
|
@wait = Selenium::WebDriver::Wait.new(:timeout => options[:upload_timeout])
|
|
14
|
-
@cookies = File.expand_path('~/.gphotos.cookies')
|
|
15
14
|
@workaround_applied = false
|
|
16
|
-
load_cookies(@cookies)
|
|
17
15
|
login(email, passwd, passwd_exec)
|
|
18
16
|
end
|
|
19
17
|
|
|
20
|
-
def load_cookies(file)
|
|
21
|
-
@driver.navigate.to 'https://photos.google.com/'
|
|
22
|
-
if File.exists?(file)
|
|
23
|
-
YAML.load_file(file).each do |cookie|
|
|
24
|
-
@driver.manage.add_cookie(cookie)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
18
|
def login(email, passwd, passwd_exec)
|
|
30
19
|
@driver.navigate.to 'https://photos.google.com/albums'
|
|
31
20
|
|
|
@@ -46,7 +35,6 @@ module Gphotos
|
|
|
46
35
|
element.submit
|
|
47
36
|
|
|
48
37
|
@driver.find_element(:css => 'input[type="file"]')
|
|
49
|
-
File.write(@cookies ,@driver.manage.all_cookies.to_yaml, :perm => 0600)
|
|
50
38
|
end
|
|
51
39
|
|
|
52
40
|
def upload(files, &block)
|
data/lib/gphotos/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gphotos
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zhong Jianxin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-01-
|
|
11
|
+
date: 2017-01-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|