Skip to content

Commit f0bac40

Browse files
committed
fix login
1 parent ea13903 commit f0bac40

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

lib/forki/scrapers/post_scraper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ def parse(url)
812812
begin
813813
post_data[:url] = url
814814
rescue StandardError
815+
raise ContentUnavailableError
815816
end
816817

817818
5.times do

lib/forki/scrapers/scraper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ def login(url = nil)
163163
login_buttons = login_form.all("div", text: "Log in", wait: 5) if login_buttons.empty?
164164

165165
if login_buttons.empty?
166-
login_form.click_button("Log In")
166+
begin
167+
login_form.click_button("Log in")
168+
rescue Capybara::ElementNotFound
169+
login_form.click_button("Log In")
170+
end
167171
else
168172
login_buttons.each do |button|
169173
if button.text == "Log In" || button.text == "Log in"

test/post_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_various_domain_types
268268

269269
def test_reel
270270
# https://www.facebook.com/reel/809749953859034
271-
post = Forki::Post.lookup("https://www.facebook.com/reel/809749953859034").first
271+
post = Forki::Post.lookup("HTTPS://www.facebook.com/REEL/2823760637824421").first
272272
assert_not_nil(post)
273273

274274
post.video_files.each do |image|

0 commit comments

Comments
 (0)