Class: SourceMonitor::Fetching::CloudflareBypass
- Inherits:
-
Object
- Object
- SourceMonitor::Fetching::CloudflareBypass
- Defined in:
- lib/source_monitor/fetching/cloudflare_bypass.rb
Constant Summary collapse
- USER_AGENTS =
[ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_4_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0" ].freeze
- CLOUDFLARE_MARKERS =
FeedFetcher::CLOUDFLARE_MARKERS
- SNIFF_LIMIT =
FeedFetcher::SNIFF_LIMIT
- DEFAULT_MAX_ATTEMPTS =
2- BYPASS_TIMEOUT =
10
Instance Attribute Summary collapse
-
#feed_url ⇒ Object
readonly
Returns the value of attribute feed_url.
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(response:, feed_url:, max_attempts: DEFAULT_MAX_ATTEMPTS) ⇒ CloudflareBypass
constructor
A new instance of CloudflareBypass.
Constructor Details
#initialize(response:, feed_url:, max_attempts: DEFAULT_MAX_ATTEMPTS) ⇒ CloudflareBypass
Returns a new instance of CloudflareBypass.
20 21 22 23 24 |
# File 'lib/source_monitor/fetching/cloudflare_bypass.rb', line 20 def initialize(response:, feed_url:, max_attempts: DEFAULT_MAX_ATTEMPTS) @response = response @feed_url = feed_url @max_attempts = max_attempts end |
Instance Attribute Details
#feed_url ⇒ Object (readonly)
Returns the value of attribute feed_url.
18 19 20 |
# File 'lib/source_monitor/fetching/cloudflare_bypass.rb', line 18 def feed_url @feed_url end |
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
18 19 20 |
# File 'lib/source_monitor/fetching/cloudflare_bypass.rb', line 18 def max_attempts @max_attempts end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
18 19 20 |
# File 'lib/source_monitor/fetching/cloudflare_bypass.rb', line 18 def response @response end |
Instance Method Details
#call ⇒ Object
26 27 28 |
# File 'lib/source_monitor/fetching/cloudflare_bypass.rb', line 26 def call || attempt_ua_rotation end |