Class: Utils::ENVData
- Inherits:
-
Object
- Object
- Utils::ENVData
- Defined in:
- lib/utils/constants.rb
Overview
constants that will be used in by search / scraping scripts
Constant Summary collapse
- MARKET_CACHE =
'./market_cache'
- BDO_CODEX_CACHE =
'./bdo_codex_cache'
- ERROR_LOG =
'./error.log'
- COOKIE =
note that the following two tokens are different!! the first one is from a request cookie the second is from the dom of the actual BDO central market interface
'__RequestVerificationToken=aVYGQPovG8EI6bRIagh8tbHJUhZlM-nH3UKVQaV9R9N0vODzmWcB747BHEsHaphwANvzsaNi5TCPlB-72-e1LadqAlL-bdkDkTqVh4gMnu81'
- RVT =
rubocop:disable Layout/LineLength
'__RequestVerificationToken=yWbqJmiU4wcp2IRQGkbDfqMFs2fjCYx4UqVxg4umK8CvdbLhweMLZ1es-4SFWD8J1UfoqwbaQyo_YuzAkSzHWY8Wjyx4ttwZBvtu_pd--9U1'
- WORLD_MARKET_LIST =
rubocop:disable Layout/LineLength
'/GetWorldMarketList'
- MARKET_SUB_LIST =
'/GetWorldMarketSubList'
- MARKET_SEARCH_LIST =
'/GetWorldMarketSearchList'
- MARKET_SELL_BUY_INFO =
'/GetItemSellBuyInfo'
- MARKET_HOT_LIST =
'/GetWorldMarketHotList'
- MARKET_WAIT_LIST =
'/GetWorldMarketWaitList'
- REQUEST_OPTS =
{ method: 'post', central_market_headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', Cookie: COOKIE, Dnt: '1', 'x-cdn': 'Imperva' }, bdo_codex_headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', Dnt: '1' } }.freeze
Class Method Summary collapse
- .get_central_market_headers(incap_cookie = '') ⇒ Object
- .get_incap_cookie(region_domain) ⇒ Object
- .get_root_url(region) ⇒ Object
Class Method Details
.get_central_market_headers(incap_cookie = '') ⇒ Object
109 110 111 112 113 114 115 116 117 |
# File 'lib/utils/constants.rb', line 109 def self.get_central_market_headers( = '') = REQUEST_OPTS[:central_market_headers][:Cookie] if rand > 0.5 REQUEST_OPTS[:central_market_headers] { **REQUEST_OPTS[:central_market_headers], 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', Cookie: "#{};#{}" } else { **REQUEST_OPTS[:central_market_headers], 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36', Cookie: "#{};#{}" } end end |
.get_incap_cookie(region_domain) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/utils/constants.rb', line 119 def self.(region_domain) new_expiry = Date.today + 365 day = Time.now.strftime("%a") month = Time.now.strftime("%b") hour = rand(1..12) minute = rand(1..60) second = rand(1..60) # TODO: EXPERIMENTAL - figure out how to simulate incapsula data "visid_incap_2504212=xoYUIj+XR/acq/q6uc0RZyLI/2cAAAAAQUIPAAAAAAAMYr/xXVQYe6Eo4uVK+L6V; expires=#{day}, #{new_expiry.day} #{month} #{new_expiry.year} #{hour}:#{minute}:#{second} GMT; HttpOnly; path=/; Domain=.#{region_domain}; Secure; SameSite=None" end |
.get_root_url(region) ⇒ Object
131 132 133 |
# File 'lib/utils/constants.rb', line 131 def self.get_root_url(region) "https://#{CLIConstants::REGION_DOMAINS[region.to_sym]}/Home" end |