forki 0.2.6 → 0.2.7

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: 78986561738c2e71c7504b8d4810c790e1cefa212b97358eae17accf4b1c2131
4
- data.tar.gz: 9f72cf4a6496e4c40f3d47d566c2ec9fd1096edf8e54257223a6b26d96f0c9b2
3
+ metadata.gz: cf93e965787eaf05b26f6ea1377775fb61ed131a52458a371336474d09e4a639
4
+ data.tar.gz: 729e9409bf76eb8551913f64e02d3905a878d057f045e16a64f712926d0d5cc8
5
5
  SHA512:
6
- metadata.gz: a6fd3e3328b1c1c17d8d4bcab492588d88d7bcfc6feb20f1e85c5b75dfacc24b75c519d388353d733bf2ef0c6899f9c1804f82736d9bdb28971f21299159fed2
7
- data.tar.gz: eb1f2608844ba87fc294d38091b6327de25e35f505ac1e873f5a56f797994de57fdf2a1e80d4781821330ff05cee15bc4f0d0fbe2f7a1b72ab7abab6806f7765
6
+ metadata.gz: 6d710aee0bb1ae64c3796de31f85a9e39f26791bd12a653785544099d9e10629a3a239f69dff5702b80b009d1e3b6c9abfef50109e7078dcb70194f9f5c65384
7
+ data.tar.gz: 0b34b2dceaeff07c844e9fc8b42f27bfe3fbaae2c631bfe80f605f1c7caa821f0387780b37cc1bdb9b6735c20a967ba51e2d6a58a0a0478ee624520ab060402d
@@ -71,6 +71,9 @@ module Forki
71
71
  if !graphql_object.dig("node", "comet_sections", "content", "story", "attachments").nil?
72
72
  if graphql_object["node"]["comet_sections"]["content"]["story"]["attachments"].count.positive?
73
73
  return true unless graphql_object["node"]["comet_sections"]["content"]["story"]["attachments"].first.dig("styles", "attachment", "all_subattachments", "nodes")&.first&.dig("media", "image", "uri").nil?
74
+
75
+ # Another version I guess
76
+ return true unless graphql_object["node"]["comet_sections"]["content"]["story"]["attachments"].first.dig("styles", "attachment", "media", "large_share_image")&.dig("uri").nil?
74
77
  end
75
78
  end
76
79
 
@@ -318,7 +321,6 @@ module Forki
318
321
  feedback_object = graphql_object["node"]["comet_sections"]["feedback"]["story"]["feedback_context"]["feedback_target_with_context"]["ufi_renderer"]["feedback"]["comet_ufi_summary_and_actions_renderer"]["feedback"]
319
322
  end
320
323
 
321
-
322
324
  if feedback_object.has_key?("cannot_see_top_custom_reactions")
323
325
  reaction_counts = extract_reaction_counts(feedback_object["cannot_see_top_custom_reactions"]["top_reactions"])
324
326
  else
@@ -326,18 +328,28 @@ module Forki
326
328
  end
327
329
 
328
330
  id = graphql_object["node"]["post_id"]
329
- num_comments = feedback_object["share_count"]["count"]
331
+ num_comments = feedback_object["comments_count_summary_renderer"]["feedback"]["comment_rendering_instance"]["comments"]["total_count"]
330
332
  reshare_warning = feedback_object["should_show_reshare_warning"]
331
333
 
332
334
  if attachments.first["styles"]["attachment"].key?("all_subattachments")
333
335
  image_url = attachments.first["styles"]["attachment"]["all_subattachments"]["nodes"].first["media"]["image"]["uri"]
334
336
  else
335
- image_url = attachments.first["styles"]["attachment"]["media"]["photo_image"]["uri"]
337
+ image_url = attachments.first.dig("styles", "attachment", "media", "photo_image", "uri")
338
+
339
+ if image_url.nil?
340
+ image_url = attachments.first["styles"]["attachment"]["media"]["large_share_image"]["uri"]
341
+ end
336
342
  end
337
343
 
338
344
  text = graphql_object["node"]["comet_sections"]["content"]["story"]["message"]["text"]
339
345
  profile_link = graphql_object["node"]["comet_sections"]["content"]["story"]["actors"].first["url"]
340
- created_at = graphql_object["node"]["comet_sections"]["content"]["story"]["comet_sections"]["context_layout"]["story"]["comet_sections"]["metadata"].first["story"]["creation_time"]
346
+
347
+ unless graphql_object["node"]["comet_sections"].dig("content", "story", "comet_sections", "context_layout", "story", "comet_sections", "metadata").nil?
348
+ created_at = graphql_object["node"]["comet_sections"].dig("content", "story", "comet_sections", "context_layout", "story", "comet_sections", "metadata")&.first["story"]["creation_time"]
349
+ else
350
+ created_at = graphql_object["node"]["comet_sections"]["context_layout"]["story"]["comet_sections"]["metadata"].first["story"]["creation_time"]
351
+ end
352
+
341
353
  has_video = false
342
354
  else
343
355
  graphql_object_array.find { |graphql_object| graphql_object.key?("viewer_actor") && graphql_object.key?("display_comments") }
@@ -4,7 +4,6 @@ class ImageSieve
4
4
  end
5
5
 
6
6
  def self.sieve_for_graphql_objects(graphql_objects)
7
-
8
7
  sieve = sieve_class_for_graphql_objects(graphql_objects)
9
8
  return nil if sieve.nil?
10
9
 
@@ -19,7 +18,6 @@ private
19
18
  end
20
19
  end
21
20
 
22
-
23
- Dir['./lib/forki/scrapers/sieves/image_sieves/*.rb'].each do |file|
21
+ Dir["./lib/forki/scrapers/sieves/image_sieves/*.rb"].each do |file|
24
22
  require file unless file.end_with?("image_sieve.rb")
25
23
  end
data/lib/forki/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Forki
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-04 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.4.20
168
+ rubygems_version: 3.5.9
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: A gem to scrape Facebook pages for archive purposes.