feed2gram 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -0
- data/example/Gemfile.lock +1 -1
- data/lib/feed2gram/publishes_posts.rb +6 -6
- data/lib/feed2gram/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be6dddfdc2c228de285536b0fbefd7a5f1d34d864fd625e21c996307cc439f1
|
4
|
+
data.tar.gz: 35509d9f7bfacf70bce7ce37fdba2ddae9bb783171a561aad80b27b5ba9b0546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf84920a3113a0bbe9c73790171e8216846aa4f7d66edeabd4ae9f58b71857a65c81630f1cc5eab094b1fe246ae5069a6086e2a798d39f9a925e3c4c2e3951cb
|
7
|
+
data.tar.gz: 3176d62ca5a41b2de36cf695771579de800fb3346ae83aa31d51d0716b780afb29dc1a49a268d2c32caf14d351120fcf7fad533e828ce38566089d446bcec63f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -96,6 +96,14 @@ Usage: feed2gram [options]
|
|
96
96
|
--populate-cache Populate the cache file with any posts found in the feed WITHOUT posting them to Instagram
|
97
97
|
```
|
98
98
|
|
99
|
+
## Environment variables
|
100
|
+
|
101
|
+
These environment variables can be set to augment the gem's behavior:
|
102
|
+
|
103
|
+
* `SECONDS_PER_UPLOAD_CHECK` - when uploading video, feed2gram must wait until
|
104
|
+
the [status code](https://tiagogrosso.github.io/instagram-graph-api-lib/enums/CONTAINER_STATUS_CODE.html) on the media indicates it is published. This variable determines how many seconds to wait between each check (defaults to 30 seconds). Shortening this value can lead to hitting one's hourly rate limit
|
105
|
+
* `MAX_UPLOAD_STATUS_CHECKS` - how many status checks to perform before giving up on a piece of media and calling the post failed. Unfortunately, Facebook's servers can take anywhere from 15 seconds to 15 hours to download and process even trivially small videos, so GLHF
|
106
|
+
|
99
107
|
## Formatting your Atom feed's HTML
|
100
108
|
|
101
109
|
feed2gram uses the first `<figure>` element to generate each Instagram post. That `<figure>` can contain one or more `<img>` tags and one `<figcaption>` tag, which will be used as the post's image(s) and caption, respectively.
|
data/example/Gemfile.lock
CHANGED
@@ -81,14 +81,14 @@ module Feed2Gram
|
|
81
81
|
Result.new(post: post, status: :posted)
|
82
82
|
end
|
83
83
|
|
84
|
-
|
85
|
-
|
84
|
+
SECONDS_PER_UPLOAD_CHECK = ENV.fetch("SECONDS_PER_UPLOAD_CHECK") { 30 }
|
85
|
+
MAX_UPLOAD_STATUS_CHECKS = ENV.fetch("MAX_UPLOAD_STATUS_CHECKS") { 100 }
|
86
86
|
# Good ol' loop-and-sleep. Haven't loop do'd in a while
|
87
87
|
def wait_for_media_to_upload!(url, container_id, config, options)
|
88
88
|
wait_attempts = 0
|
89
89
|
loop do
|
90
|
-
if wait_attempts >
|
91
|
-
warn "Giving up waiting for media to upload after waiting #{
|
90
|
+
if wait_attempts > MAX_UPLOAD_STATUS_CHECKS
|
91
|
+
warn "Giving up waiting for media to upload after waiting #{SECONDS_PER_UPLOAD_CHECK * MAX_UPLOAD_STATUS_CHECKS} seconds: #{url}"
|
92
92
|
break
|
93
93
|
end
|
94
94
|
|
@@ -96,12 +96,12 @@ module Feed2Gram
|
|
96
96
|
fields: "status_code",
|
97
97
|
access_token: config.access_token
|
98
98
|
})
|
99
|
-
puts "Upload status #{res[:status_code]} after waiting #{wait_attempts *
|
99
|
+
puts "Upload status #{res[:status_code]} after waiting #{wait_attempts * SECONDS_PER_UPLOAD_CHECK} seconds for IG to download #{url}" if options.verbose
|
100
100
|
if res[:status_code] == "FINISHED"
|
101
101
|
break
|
102
102
|
elsif res[:status_code] == "IN_PROGRESS"
|
103
103
|
wait_attempts += 1
|
104
|
-
sleep
|
104
|
+
sleep SECONDS_PER_UPLOAD_CHECK
|
105
105
|
else
|
106
106
|
warn "Unexpected status code (#{res[:status_code]}) uploading: #{url}"
|
107
107
|
break
|
data/lib/feed2gram/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feed2gram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|