A command line (CLI) program for monitoring and downloading 8chan threads. Licensed under MIT.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lizard.py 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env python
  2. import sys
  3. from logic import *
  4. def help_info():
  5. print(""" _.-~` `~-.
  6. _.--~~~---,.__ _.,;; . -=(@'`\\
  7. .-` ``~~~~--~~` ';;; ____)
  8. _.' '. ';;;;; '`_.'
  9. .-~;` `\ ' ';;;;;__.~`
  10. .' .' `'. | / /;''
  11. \/ .---'''``) /'-._____.--'\ \\
  12. _/| (` / /` `\ \__
  13. ', `/- \ \ __/ (_ /-\-\-`
  14. `;'-..___) | `/-\-\-` Lizard
  15. `-. .' the 8chan monitor
  16. `~~~~``
  17. Usage: ./lizard [command] [options]
  18. Available commands:
  19. l - Lists all threads in database. Legend: ! - new replies, x - 404'd.
  20. r - Refresh all threads and update database.
  21. o - Open all threads with new replies in the default browser. Will also update the "new replies"
  22. field accordingly.
  23. i - Initialize new database.
  24. g - Get (download) thread and the files in it. Requires option (URL of the thread).
  25. Example: "lizard a https://8ch.net/
  26. a - Add thread to database. Requires option (URL of the thread). Will also attempt to download
  27. the thread.
  28. d - Remove all instances of a thread (board & number) from the database.
  29. Example: "lizard d b 123" will remove thread >>>/b/123
  30. """)
  31. exit()
  32. if __name__ == '__main__':
  33. os.chdir(sys.path[0]) # set working directory to this script's directory
  34. n = len(sys.argv)
  35. if n < 2: help_info()
  36. command = sys.argv[1]
  37. if n == 2:
  38. if command == 'r':
  39. refresh_all_threads()
  40. elif command == 'l':
  41. list_threads()
  42. elif command == 'o':
  43. open_threads_with_new_replies()
  44. elif command == 'i':
  45. initialize_database()
  46. else:
  47. help_info()
  48. elif n == 3:
  49. if command == 'a':
  50. add_thread_to_db(sys.argv[2])
  51. elif command == 'g':
  52. dump_thread_by_url(sys.argv[2])
  53. else:
  54. help_info()
  55. elif n == 4:
  56. if command == 'd':
  57. remove_thread_by_id(sys.argv[2], sys.argv[3])
  58. else:
  59. help_info()
  60. else:
  61. help_info()