Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to fetch and search through a paste
- local function searchPaste(url, searchTerm)
- local response, err = http.get(url)
- if not response then
- print("Error fetching data from " .. url .. ": " .. err)
- return false
- end
- local data = response.readAll()
- response.close()
- -- Check if the search term is in the paste content
- if string.find(data, searchTerm) then
- print("Found in " .. url .. ": " .. searchTerm)
- print("Content: \n" .. data) -- Print the content of the paste
- return true
- else
- return false
- end
- end
- -- Main execution
- print("Enter search term:")
- local searchTerm = read() -- Read the search term
- -- Input the URLs of pastes you want to search through
- print("Enter Pastebin URLs (one per line, type 'done' to finish):")
- local pasteUrls = {}
- while true do
- local url = read()
- if url == "done" then
- break
- end
- table.insert(pasteUrls, url)
- end
- -- Search through all the provided paste URLs
- local foundAny = false
- for _, url in ipairs(pasteUrls) do
- if searchPaste(url, searchTerm) then
- foundAny = true
- end
- end
- if not foundAny then
- print("No results found for: " .. searchTerm)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement