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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d691dfcfb802c2d4393f743477774d780e02baedc659bcc5ac21cee6e28112a0
4
- data.tar.gz: bcc08f9e5ccc77878b5c96d5670145d36d10f928cdc167251609c46d5591f3e8
3
+ metadata.gz: 53761f7c0404c405fbd7e7da9d9a8119cb732ad0aaab619dce013303dce73f3b
4
+ data.tar.gz: 6aa32acbf2fcda146478c13f8593cdf0836f90f99d3fa89f74279b4e185bab0c
5
5
  SHA512:
6
- metadata.gz: 45e8ee4c15858a771099a159af2d54ce0cb0596a3f4b3f473c438f958d8b74d5a66eed4a5900cb0cdc7cecb7fb7e006dc72d1611c0a1d9fd2442497970da6f21
7
- data.tar.gz: ccd6437b340406d367393a1356bc93a5329c44ea30ec7a559d0f99b85519e7169728c02ef762c78df805cd27af67ad4b305c17bb25f2658b8746fa09953fdce6
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
- if !memory['last_status']
248
+
249
+ if payload != memory['last_status']
249
250
  payload['items'].each do |video|
250
- create_event payload: video
251
- end
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
- payload['items'].each do |video|
259
- found = false
260
- if interpolated['debug'] == 'true'
261
- log "video"
262
- log video
263
- end
264
- last_status['items'].each do |videobis|
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
- memory['last_status'] = payload
280
- else
281
- if interpolated['debug'] == 'true'
282
- log "nothing to compare"
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.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: 2023-09-17 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler