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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f7ca98db2cd00345d0f9752ee3cbecb4a08802788a12b0c4ff96ea88e7564d6
4
- data.tar.gz: 9431ebbf3b607ed4c2741dd2566ba1769b9decf999cf4797dffbd067afe9ffa0
3
+ metadata.gz: 6be6dddfdc2c228de285536b0fbefd7a5f1d34d864fd625e21c996307cc439f1
4
+ data.tar.gz: 35509d9f7bfacf70bce7ce37fdba2ddae9bb783171a561aad80b27b5ba9b0546
5
5
  SHA512:
6
- metadata.gz: e4d526ea17064ed90989d26df897d9d0f149c53b59afb0fbdc42099a9ffaccc96c9d70a74999c7b973a037dc484e130904f975f8b6ebfe3a8992c64847dc5b64
7
- data.tar.gz: '090b8873287f0c87df039c457b2f1129620908b0ffa71c1098c4259f0856e03399fa9bd2690ffb15885b895a0d2fb1659ac59d9d7643865975b2b836e2a351db'
6
+ metadata.gz: cf84920a3113a0bbe9c73790171e8216846aa4f7d66edeabd4ae9f58b71857a65c81630f1cc5eab094b1fe246ae5069a6086e2a798d39f9a925e3c4c2e3951cb
7
+ data.tar.gz: 3176d62ca5a41b2de36cf695771579de800fb3346ae83aa31d51d0716b780afb29dc1a49a268d2c32caf14d351120fcf7fad533e828ce38566089d446bcec63f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.2.1]
2
+
3
+ * Add `SECONDS_PER_UPLOAD_CHECK` and `MAX_UPLOAD_STATUS_CHECKS` env vars
4
+
1
5
  ## [1.2.0]
2
6
 
3
7
  * Add support for the `cover_url` property for reel posts by way of a
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- feed2gram (1.2.0)
4
+ feed2gram (1.2.1)
5
5
  nokogiri (~> 1.15)
6
6
 
7
7
  GEM
@@ -81,14 +81,14 @@ module Feed2Gram
81
81
  Result.new(post: post, status: :posted)
82
82
  end
83
83
 
84
- SECONDS_PER_WAIT = 30
85
- MAX_WAIT_ATTEMPTS = 100
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 > MAX_WAIT_ATTEMPTS
91
- warn "Giving up waiting for media to upload after waiting #{SECONDS_PER_WAIT * MAX_WAIT_ATTEMPTS} seconds: #{url}"
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 * SECONDS_PER_WAIT} seconds for IG to download #{url}" if options.verbose
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 SECONDS_PER_WAIT
104
+ sleep SECONDS_PER_UPLOAD_CHECK
105
105
  else
106
106
  warn "Unexpected status code (#{res[:status_code]}) uploading: #{url}"
107
107
  break
@@ -1,3 +1,3 @@
1
1
  module Feed2Gram
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
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.0
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-09 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri