forki 0.2.9 → 0.2.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: be729f6e73f3a233ef2337076e907a5f62abd6d82541d38cf59ac4cf97ba99ae
4
- data.tar.gz: 8cd062ac0cf5688f60fd1d2afd6718013f7bd1a5a037194ee01135f9bb890f15
3
+ metadata.gz: a7f3c7b6c1fc45dcd2c162f6ff308f3187e07c54b921739d16c37395e3574324
4
+ data.tar.gz: ed7537f07b914f4500a31e948b2ee1cc8c375a15a36ea971c7186a7dbd5a7935
5
5
  SHA512:
6
- metadata.gz: f0f6002e321608fc472775ddeef2b476336ad2f104d7a82063c9b8d05ec15f6e795d09dfe67a9990653fb7297c9f82dc200032285143ef43a178b458801669ad
7
- data.tar.gz: a8e5a9311783f97d6acbb628025ee6d1513ebdffe1e957b80658a3bf03f8261109fc50d4c7d765b4557046fd03288ce39627cc84deab774b6ac68023aa782dc3
6
+ metadata.gz: ed836bcedbe80ef77780183d0bdcc9618d8449bed16c996c1413b109360b13e343d72ffaca8b4b4da3ea42788b29a895ba2eac22be4a57523dd232144500f412
7
+ data.tar.gz: a676e6f6cae22491bf7d7d1ad916e8e14f96832f0000c1c60b222759cfed89fb3875c67f9a02253ee19adb9f9e247190e97e4a056b921a0b6a210c24e0e37d18
@@ -505,7 +505,11 @@ module Forki
505
505
  # Do nothing if element not found
506
506
  end
507
507
 
508
- save_screenshot("#{Forki.temp_storage_location}/facebook_screenshot_#{SecureRandom.uuid}.png")
508
+ begin
509
+ save_screenshot("#{Forki.temp_storage_location}/facebook_screenshot_#{SecureRandom.uuid}.png")
510
+ rescue Selenium::WebDriver::Error::TimeoutError
511
+ raise Net::ReadTimeout
512
+ end
509
513
  end
510
514
 
511
515
  # Uses GraphQL data and DOM elements to collect information about the current post
@@ -536,14 +540,20 @@ module Forki
536
540
  rescue Net::ReadTimeout => e
537
541
  puts "Time out error: #{e}"
538
542
  puts e.backtrace
543
+ raise Forki::RetryableError # This insures it'll eventually be retried by Hypatia
539
544
  rescue StandardError => e
540
545
  raise e
546
+ raise Forki::RetryableError
541
547
  ensure
542
548
  # `page` here can be broken already. In which case we want to raise an error so it's retried later
543
549
  begin
544
550
  page.quit
545
551
  rescue Curl::Err::ConnectionFailedError
546
- raise Forki::RretryableError # This insures it'll eventually be retried by Hypatia
552
+ raise Forki::RetryableError # This insures it'll eventually be retried by Hypatia
553
+ rescue StandardError => e
554
+ puts "Error closing browser: #{e}"
555
+ raise e
556
+ # raise Forki::RetryableError
547
557
  end
548
558
  end
549
559
  end
@@ -41,12 +41,15 @@ class VideoSieveWatchTab < VideoSieve
41
41
  def self.sieve(graphql_objects)
42
42
  video_object = self.extractor(graphql_objects)
43
43
 
44
- # video_url = video_object["attachments"].first["media"]["browser_native_sd_url"]
45
- video_url = video_object["short_form_video_context"]["playback_video"]["browser_native_hd_url"]
46
- video_url = video_object["short_form_video_context"]["playback_video"]["browser_native_sd_url"] if video_url.nil?
44
+ video_url = video_object["attachments"]&.first.dig("media", "browser_native_sd_url")
47
45
 
48
- # video_preview_image_url = video_object["attachments"].first["media"]["preferred_thumbnail"]["image"]["uri"]
49
- video_preview_image_url = video_object["short_form_video_context"]["video"]["first_frame_thumbnail"]
46
+ video_url = video_object.dig("short_form_video_context", "playback_video", "browser_native_hd_url") if video_url.nil?
47
+ video_url = video_object.dig("short_form_video_context", "playback_video", "browser_native_sd_url") if video_url.nil?
48
+
49
+ debugger if video_url.nil?
50
+
51
+ video_preview_image_url = video_object["attachments"]&.first.dig("media", "preferred_thumbnail", "image", "uri")
52
+ video_preview_image_url = video_object["short_form_video_context"]["video"]["first_frame_thumbnail"] if video_preview_image_url.nil?
50
53
 
51
54
  if !video_object["feedback_context"].nil?
52
55
  feedback_object = video_object["feedback_context"]["feedback_target_with_context"]
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.9"
4
+ VERSION = "0.2.11"
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.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara