Advertisement
DOGGYWOOF

Untitled

Oct 23rd, 2024 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2.  
  3. -- Function to fetch and search through a paste
  4. local function searchPaste(url, searchTerm)
  5. local response, err = http.get(url)
  6. if not response then
  7. print("Error fetching data from " .. url .. ": " .. err)
  8. return false
  9. end
  10.  
  11. local data = response.readAll()
  12. response.close()
  13.  
  14. -- Check if the search term is in the paste content
  15. if string.find(data, searchTerm) then
  16. print("Found in " .. url .. ": " .. searchTerm)
  17. print("Content: \n" .. data) -- Print the content of the paste
  18. return true
  19. else
  20. return false
  21. end
  22. end
  23.  
  24. -- Main execution
  25. print("Enter search term:")
  26. local searchTerm = read() -- Read the search term
  27.  
  28. -- Input the URLs of pastes you want to search through
  29. print("Enter Pastebin URLs (one per line, type 'done' to finish):")
  30. local pasteUrls = {}
  31. while true do
  32. local url = read()
  33. if url == "done" then
  34. break
  35. end
  36. table.insert(pasteUrls, url)
  37. end
  38.  
  39. -- Search through all the provided paste URLs
  40. local foundAny = false
  41. for _, url in ipairs(pasteUrls) do
  42. if searchPaste(url, searchTerm) then
  43. foundAny = true
  44. end
  45. end
  46.  
  47. if not foundAny then
  48. print("No results found for: " .. searchTerm)
  49. end
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement