huginn_youtube_agent 0.1.1 → 0.1.11
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/huginn_youtube_agent/youtube_agent.rb +25 -27
- 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: 53761f7c0404c405fbd7e7da9d9a8119cb732ad0aaab619dce013303dce73f3b
|
4
|
+
data.tar.gz: 6aa32acbf2fcda146478c13f8593cdf0836f90f99d3fa89f74279b4e185bab0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e76db73e45ed3853bf7a3f2ba79a93bee95e42d387473eebead7ee77b3e61231c307882997c87ceae880e6d1a206e4fa3f9d2e033e7cc1d1e42e9867c14b3a96
|
7
|
+
data.tar.gz: f850b27a204e76964905cf125f281e8d7fc6a912c386fd5256954dfdaa50d2e6bad43538b50fca5b46f528b534c0a58125b259d88ed0eefa978bd1954c8544b7
|
@@ -230,7 +230,7 @@ module Agents
|
|
230
230
|
|
231
231
|
def check_videos()
|
232
232
|
|
233
|
-
uri = URI.parse("https://www.googleapis.com/youtube/v3/search?key=#{interpolated['youtube_api_key']}&channelId=#{interpolated['channel_id']}&part=snippet,id&order=date&maxResults=#{interpolated['limit']}")
|
233
|
+
uri = URI.parse("https://www.googleapis.com/youtube/v3/search?key=#{interpolated['youtube_api_key']}&channelId=#{interpolated['channel_id']}&type=video&part=snippet,id&order=date&maxResults=#{interpolated['limit']}")
|
234
234
|
request = Net::HTTP::Get.new(uri)
|
235
235
|
request["Accept"] = "application/json"
|
236
236
|
|
@@ -245,44 +245,42 @@ module Agents
|
|
245
245
|
log_curl_output(response.code,response.body)
|
246
246
|
|
247
247
|
payload = JSON.parse(response.body)
|
248
|
-
|
248
|
+
|
249
|
+
if payload != memory['last_status']
|
249
250
|
payload['items'].each do |video|
|
250
|
-
|
251
|
-
|
252
|
-
memory['last_status'] = payload
|
253
|
-
else
|
254
|
-
if payload != memory['last_status']
|
255
|
-
if memory['last_status'] == ''
|
256
|
-
else
|
251
|
+
found = false
|
252
|
+
if !memory['last_status'].nil? and memory['last_status'].present?
|
257
253
|
last_status = memory['last_status']
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
if video['id'] == videobis['id']
|
266
|
-
found = true
|
267
|
-
end
|
254
|
+
if interpolated['debug'] == 'true'
|
255
|
+
log "video"
|
256
|
+
log video
|
257
|
+
end
|
258
|
+
last_status['items'].each do |videobis|
|
259
|
+
if video['id'] == videobis['id']
|
260
|
+
found = true
|
268
261
|
if interpolated['debug'] == 'true'
|
262
|
+
log "found is #{found}"
|
269
263
|
log "videobis"
|
270
264
|
log videobis
|
271
|
-
log "found is #{found}!"
|
272
265
|
end
|
273
266
|
end
|
274
|
-
if found == false
|
275
|
-
create_event payload: video
|
276
|
-
end
|
277
267
|
end
|
278
268
|
end
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
269
|
+
if found == false
|
270
|
+
create_event payload: video
|
271
|
+
else
|
272
|
+
if interpolated['debug'] == 'true'
|
273
|
+
log "found is #{found}"
|
274
|
+
end
|
283
275
|
end
|
284
276
|
end
|
277
|
+
memory['last_status'] = payload
|
278
|
+
else
|
279
|
+
if interpolated['debug'] == 'true'
|
280
|
+
log "no diff"
|
281
|
+
end
|
285
282
|
end
|
283
|
+
|
286
284
|
end
|
287
285
|
|
288
286
|
def trigger_action
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huginn_youtube_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Germain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|