forki 0.2.15 → 0.2.17
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9500f6b5531d22bd8f1a227c9f7c241bacd594221bf4ce9d717d98090411b1
|
4
|
+
data.tar.gz: 1bd7ac04cce0047d98151671cdf7812e99d50701ed3ba7877c569256f7de40f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46c9fa11210476a43629ff6870207227b657912c3cacd9ca4b84d63d1391219ac8964d9ca9581e3c24e5ceec0afe816c252605bb07175a1d9f81f00507b01c7d
|
7
|
+
data.tar.gz: 53adaa95825c4f27987d9fe2ee5dd873eb4da28c2415961a61a092240c0691482ba79fecbc1681f4aa8df22c5fff826ad1c1f94c25c5a191bbc9f8aa1b884fcc
|
@@ -33,12 +33,12 @@ module Forki
|
|
33
33
|
|
34
34
|
if post_is_text_only
|
35
35
|
extract_text_post_data(graphql_objects)
|
36
|
+
elsif post_has_image && !post_has_video && !post_has_video_in_comment_stream
|
37
|
+
extract_image_post_data(graphql_objects)
|
36
38
|
elsif post_has_video
|
37
39
|
extract_video_post_data(graphql_strings)
|
38
40
|
elsif post_has_video_in_comment_stream
|
39
41
|
extract_video_comment_post_data(graphql_objects)
|
40
|
-
elsif post_has_image
|
41
|
-
extract_image_post_data(graphql_objects)
|
42
42
|
else
|
43
43
|
extract_image_post_data(graphql_objects)
|
44
44
|
end
|
@@ -84,6 +84,7 @@ module Forki
|
|
84
84
|
return true unless graphql_object.fetch("image", nil).nil? # so long as the associated values are not nil
|
85
85
|
return true unless graphql_object.fetch("currMedia", nil).nil?
|
86
86
|
return true unless graphql_object.fetch("photo_image", nil).nil?
|
87
|
+
return true unless graphql_object.fetch("large_share_image", nil).nil?
|
87
88
|
|
88
89
|
# This is a complicated form for `web.facebook.com` posts
|
89
90
|
if !graphql_object.dig("node", "comet_sections", "content", "story", "attachments").nil?
|
@@ -329,11 +330,10 @@ module Forki
|
|
329
330
|
reshare_warning = feedback_object["comet_ufi_summary_and_actions_renderer"]["feedback"]["should_show_reshare_warning"]
|
330
331
|
end
|
331
332
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
end
|
333
|
+
video_object_url_subsearch = video_object
|
334
|
+
video_object_url_subsearch = video_object_url_subsearch["videoDeliveryLegacyFields"] if video_object_url_subsearch.has_key?("videoDeliveryLegacyFields")
|
335
|
+
# if video_object.key?("browser_native_hd_url") || video_object.key?("browser_native_sd_url")
|
336
|
+
video_url = video_object_url_subsearch["browser_native_hd_url"] || video_object_url_subsearch["browser_native_sd_url"]
|
337
337
|
|
338
338
|
post_details = {
|
339
339
|
id: video_object["id"],
|
@@ -442,6 +442,10 @@ module Forki
|
|
442
442
|
if image_url.nil?
|
443
443
|
image_url = attachments.first&.dig("styles", "attachment", "media", "large_share_image", "uri")
|
444
444
|
end
|
445
|
+
|
446
|
+
if image_url.nil?
|
447
|
+
image_url = attachments.first&.dig("styles", "attachment", "media", "image", "uri")
|
448
|
+
end
|
445
449
|
end
|
446
450
|
|
447
451
|
text = graphql_object["node"]["comet_sections"]["content"]["story"].dig("message", "text")
|
@@ -46,9 +46,16 @@ class VideoSieveWatchTab < VideoSieve
|
|
46
46
|
video_url = video_object.dig("short_form_video_context", "playback_video", "browser_native_hd_url") if video_url.nil?
|
47
47
|
video_url = video_object.dig("short_form_video_context", "playback_video", "browser_native_sd_url") if video_url.nil?
|
48
48
|
|
49
|
+
video_url = video_object["attachments"]&.first.dig("media", "videoDeliveryLegacyFields", "browser_native_hd_url") if video_url.nil?
|
50
|
+
video_url = video_object["attachments"]&.first.dig("media", "videoDeliveryLegacyFields", "browser_native_sd_url") if video_url.nil?
|
51
|
+
|
52
|
+
raise VideoSieveFailedError.new(sieve_class: "VideoSieveWatchTab") if video_url.nil?
|
53
|
+
|
49
54
|
video_preview_image_url = video_object["attachments"]&.first.dig("media", "preferred_thumbnail", "image", "uri")
|
50
55
|
video_preview_image_url = video_object["short_form_video_context"]["video"]["first_frame_thumbnail"] if video_preview_image_url.nil?
|
51
56
|
|
57
|
+
raise VideoSieveFailedError.new(sieve_class: "VideoSieveWatchTab") if video_preview_image_url.nil?
|
58
|
+
|
52
59
|
if !video_object["feedback_context"].nil?
|
53
60
|
feedback_object = video_object["feedback_context"]["feedback_target_with_context"]
|
54
61
|
else
|
data/lib/forki/version.rb
CHANGED
data/lib/forki.rb
CHANGED
@@ -48,6 +48,13 @@ module Forki
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
class VideoSieveFailedError < StandardError
|
52
|
+
def initialize(msg = "Video sieve failed to find a video", sieve_class: VideoSieve)
|
53
|
+
self.msg = "#{sieve_class} failed to find a video" if msg.nil?
|
54
|
+
super
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
51
58
|
define_setting :temp_storage_location, "tmp/forki"
|
52
59
|
|
53
60
|
# Extract the file extension from a media URL
|
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.
|
4
|
+
version: 0.2.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|