Skip to content

Commit 0f92ddd

Browse files
authored
Update pastebin.lua
Added user agent of a real browser (mine) to bypass what looks like an anti-scraping protection.
1 parent 2502094 commit 0f92ddd

File tree

1 file changed

+5
-2
lines changed
  • src/main/resources/assets/opencomputers/loot/openos/bin

1 file changed

+5
-2
lines changed

src/main/resources/assets/opencomputers/loot/openos/bin/pastebin.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ local function get(pasteId, filename)
2222

2323
io.write("Downloading from pastebin.com... ")
2424
local url = "https://pastebin.com/raw/" .. pasteId
25-
local result, response = pcall(internet.request, url)
25+
26+
-- User agent added to impersonate real browsers and bypass anti-scraping protection
27+
local result, response = pcall(internet.request, url, nil, {["User-Agent"]="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0"})
28+
2629
if result then
2730
io.write("success.\n")
2831
for chunk in response do
@@ -150,4 +153,4 @@ io.write("pastebin get [-f] <id> <file>\n")
150153
io.write("pastebin run [-f] <id> [<arguments...>]\n")
151154
io.write(" -f: Force overwriting existing files.\n")
152155
io.write(" -k: keep line endings as-is (will convert\n")
153-
io.write(" Windows line endings to Unix otherwise).")
156+
io.write(" Windows line endings to Unix otherwise).")

0 commit comments

Comments
 (0)