Skip to content

Include response headers in wget.callbacks #28

@exurd

Description

@exurd

This will eliminate the workaround of using other internet request programs to get response headers (like the one in roblox-assets-grab):

-- hack: i need to grab `roblox-assetversionnumber` from the api,
-- as the version 0 is the latest version and will avoid us from doing
-- multiple requests just to find the last version.
-- because wget-lua does not display response headers,
-- i have to request the url in this script. yay!
--
-- hack hack: http.socket sucks, just use *normal* wget
--
-- hack hack hack: use v2 because it's json so it doesn't redirect
-- which confuses this script and screws up the whole thing
-- ik it's confusing using /assetId/* and /assetId/*/version/* as different items,
-- but this whole wget-lua is alien to me and this just works

local asset_id = url:match("/v2/assetId/([0-9]+)$")
if asset_id then
  local command = 'wget -q -S -U "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0" -O /dev/null "' .. url .. '" 2>&1'
  local handle = io.popen(command)
  local output = handle:read("*a")
  handle:close()

  local version_number = output:match("roblox%-assetversionnumber: (%d+)")
end

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions