parsers_helper.cr 873 B

123456789101112131415161718192021222324252627282930313233343536
  1. require "db"
  2. require "json"
  3. require "kemal"
  4. require "protodec/utils"
  5. require "spectator"
  6. require "../src/invidious/exceptions"
  7. require "../src/invidious/helpers/macros"
  8. require "../src/invidious/helpers/logger"
  9. require "../src/invidious/helpers/utils"
  10. require "../src/invidious/videos"
  11. require "../src/invidious/videos/*"
  12. require "../src/invidious/comments/content"
  13. require "../src/invidious/helpers/serialized_yt_data"
  14. require "../src/invidious/yt_backend/extractors"
  15. require "../src/invidious/yt_backend/extractors_utils"
  16. OUTPUT = File.open(File::NULL, "w")
  17. LOGGER = Invidious::LogHandler.new(OUTPUT, LogLevel::Off)
  18. def load_mock(file) : Hash(String, JSON::Any)
  19. file = File.join(__DIR__, "..", "mocks", file + ".json")
  20. content = File.read(file)
  21. return JSON.parse(content).as_h
  22. end
  23. Spectator.configure do |config|
  24. config.fail_blank
  25. config.randomize
  26. end