GithubHelp home page GithubHelp logo

wtheisen / terminusbrowser Goto Github PK

View Code? Open in Web Editor NEW
123.0 7.0 17.0 34.1 MB

CLI Reddit, Hacker News, 4chan, and lainchan browser

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
4chan reddit open-source urwid python3 lainchan hackernews

terminusbrowser's Introduction

Actions Status PRs Welcome

TerminusBrowser - a terminal 4chan/Reddit browser

  1. Introduction
  2. Screenshots
  3. Hotkeys
  4. Configuration
  5. Contributing
  6. TODO List

Introduction

Previously known as commandChan.

Created out of a desire to browse 4chan at work, TerminusBrowser is turning into a general framework for browsing sites in the terminal using a single program. This is currently a terminal browsing application for 4chan, Reddit, Hacker News, and lainchan. Built using the urwid library for python. It also makes use of the 4chan API, the Reddit API, a third-party Hacker News API, and the lainchan API. Development for all sites are still on-going so while basic browsing will work there may be smaller bugs or features than you may notice. Please feel free to notify the dev team by opening an issue, or PRs are always welcome!

To run, first install the dependencies in requirements.txt

pip3 install -r requirements.txt

And then run ./terminus_browser.py

Screenshots

Click on photo for more detail

4chan

Board Index Board View Thread view

Reddit

Subreddit Index Subreddit View Post View

Lainchan

Board Index Board view Thread View

Hotkeys

  • ':' - Puts you in command mode where you can type full commands
  • 'esc' - Puts you in normal mode where the usual hotkeys will work
  • HJKL - Normal vim like navigation for selectable objects

Commands

  • (q)uit(a)ll - Close the program
  • (t)hread [THREAD NUMBER] - open the thread on the current board with the specified number
  • view [PATTERN] - [PATTERN] being [4chan/reddit/hackernews/lainchan/history] currently it will open that site in the current view
  • (h)istory - will go back one level in the history list
  • (s)earch [PATTERN] - will search the current view for the pattern, if pattern is blank it will reset the current view
  • add [reddit/4chan] [PATTERN] - will add the subreddit or board [PATTERN] to the site index specified.

Configuration

  • To change the default site you can modify the config.json file [FCHAN/REDDIT]
  • The config.json file also contains the boards list and the subreddit list

Contributing

Development on TerminusBrowser is not active per-say, however I am still very much online so if you post an issue or feature request you will get a response.

TODO List

  • Display images links on posts
  • Board and Thread fetch information in the footer
  • Filtering options on all pages with information in the footer
  • HJKL movement
  • Full suite of commands
    • Search command for current view
    • Thread command to view thread by number
    • Toggle to show or hide stickied reddit posts
    • Download image(s) for later viewing
    • Filtering reddit comments based on score
  • Toggleable display modes(boxes, tree, cascade)
  • Display comment replies in the info bar at the top of the comment
  • History Frame
  • Quote button full interaction
    • Quotes of OP have the (OP) designator
    • Interacting with Quotes displays a preview of said Quote
    • Size of preview depends on size of quote being previewed
    • Chain Quote Previews together to view up the quote tree
  • Split view based on hotkeys
  • Timed updating of threads
  • Posting from the client
  • Full Reddit Functionality
    • Pagination
    • Tree comment structure
  • Hacker News Functionality
  • Lobster.rs Functionality

terminusbrowser's People

Contributors

ckraeme2 avatar daehli avatar ginglis13 avatar iamshnoo avatar kirkins avatar mpernigo avatar noyoshi avatar sambattalio avatar sipty avatar wtheisen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

terminusbrowser's Issues

Frame Variable Storage

So frames need to have member variables and right now they're stored as actual variables of the class. However I think as we move forward this might cause problems with extensibility. I was thinking it might make more sense to instead have a single dictionary in each frames called "options" or something and then the code can just store any kind of value it likes. This also allows code to make assumptions that a variable is there and means we don't need to keep adding member variables into frames.

What do you guys think about that?
@sambattalio @ginglis13

Command Collision Error Checking/Site specific ordering

Issue and Steps to Reproduce

Currently it's possible for two command sets for different sites to have the same commands. This will cause an issue of one command always being executed due to that sites processing being done first. For example it's reasonable that both 4chan and reddit might have a command named 'Post'. It might be nice to either print an error message if there is a shared command, or conversely it should also be easy to route the command to the parser for the currently viewed site. This would be ideal as it would allowed shared commands with no collisions.

Hackernews - Loading Stories

Issue

Making this an issue for visibility. Loading 100 stories using the official API takes roughly 20s. For comparison, loading 100 reddit posts typically takes between .8-2 seconds. I will work towards implementing the unofficial api for use in loading the storyView (it is already used for loading a post and its comments). I would expect this api to load items much more efficiently.

Update Name Instances

Due to our recent name change we need to update all the instances of the old name and IRC channel in the docs and code! This should be really easy to do and would be a great beginner PR!!

Conformity to PEP8 File Naming Conventions

Issue and Steps to Reproduce

Currently files are named in a camel-case style, due to what I originally learned when I started programming. However PEP8 specifies that modules(files) should be named in a snake case manner. It might be good to move towards more compliance with PEP8 style suggestions

I want to use this at school but I can't in install PIP

Issue and Steps to Reproduce

I can't install pip so i can't install the dependencies. I don't k now anything about coding but is it possible to make this an exe?

Version

Screenshots

Expected

Actual

Additional Details

  • Installed packages:

Name change

So it seems like the general consensus on the irc channel (#commandChan on Freenode) is that we might want to change the name of the project now that it is a bit more general and has more features than just 4chan.

So I guess this thread can be a suggestion thread for name ideas.

Here are a few ideas to get the name juices flowing:

  • TermViewer
  • commandChannels
  • Command
  • CommandViewer

@wtheisen thoughts?

Coloring Relevant Information

Right now all of the text in the frames, other than greentext and quotes, is just grey. It might be nice to, on 4chan for instance, color the same post number a consistent color throughout a thread. Just coloring relevant information so the text becomes easier to parse would be nice.

Can't quit program using source file

Issue and Steps to Reproduce

echo qa > ./qa
call source qa

Debug.log

The debug log shows the execute command was triggered, but it's not being called
[ WARNING]:commandHandlerClass.py #31 --- source qa
[ DEBUG]:SystemCommands.py #38 --- Executing quit command
[ DEBUG]:SystemCommands.py #72 --- ERROR: Unable to source qa
[ DEBUG]:splitTracker.py #17 --- True

Expected

program to quit

Actual

program not quitting

Feature Request: PyPi Package

This too ambitious for a current release? Maybe a v2 milestone? I think it's a much, much more elegant solution to the current method.

Feat: Update Reddit to PRAW

Issue and Steps to Reproduce

There is an incoming PR just want to attach an issue in case anyone has thoughts on it.

I am thinking it is time for me to switch from requests to PRAW for the reddit side of Terminus, as it handles oauth for posting much better than I could whip up with refreshing and everything. The goal is to not reinvent the wheel, and I feel like this wouldn't necessarily be bloat.

Let me know if you have any thoughts or concerns about this.

Feature Request: debug.log refresh on new instance

When I run ./TerminusBrowser.py the debug.log does not refresh on a new instance of the browser, so the log has a bunch of old information in it.

It might be nice to actually have that refresh on a reboot of the browser so we don't have to manually delete every time :)

Lainchan board improvements.

Right now because of how the 4chan API works, we use something that doesn't exist in the lainchan api to populate the board boxes. This leads to a number of lainchan board boxes just being empty. It might be nice to standardize that and always use the first X characters from the comment field to fill the boxes. This would work across both APIs and wouldn't be that hard to add!

Generalizing frame visual structure

@noyoshi what do you think about pushing the visual(urwid) pieces of the frames up a level of abstraction? If we made tree view, and in-line box view generic inheritable methods it would make adding new sites incredibly easy. All the site frame would have to do is set up the data correctly and pass it to the generalized display function that's correct for the data and it'd set up the contents for the site.

Mouse click causes crash

Issue and Steps to Reproduce

If you click anywhere on the window with the mouse the program crashes

Version

current

Expected

The program doesn't fatally crash.

Actual

The program crashes.

Feat Request: Settings View

Feature Request: Settings View

As the project grows, I think it would be nice to have a settings view. I'm thinking a user could enter :view settings to see a nicely formatted view of their config. Just viewing is a start, and maybe this could be expanded further at some point to allow editing of config from within the program !

Fix text wrapping on subreddits

Issue and Steps to Reproduce

Looks as though the "buttons" were made for smaller 4chan boards, however some subreddits are fairly long.

What do you think we should do?

To reproduce:
:reddit and you should see how it wraps pretty bad.

Version

latest from source

Screenshots

cchan

Expected

Probably some sort of custom sizing views? I don't know if this is something to fix but it looks kinda bad.

Actual

Wrap text if longer than 6 characters.

Additional Details

  • Installed packages:
    Terminal: iterm2

Reddit - Stickied Posts?

Should the reddit jawn skip stickied posts on each subreddit or include those?

Also would it be cool to add an option to the config file for the default site i.e. reddit or chan

Feature Request: Testing

Obviously something that is not urgent, but would be cool to make a suite of tests for commandChan. I especially would like to do this b/c I don't have much experience writing tests.

Elegant input command handling

Issue and Steps to Reproduce

Feeding b or t causes the program to crash

Feeding history reddit causes the program to crash

Error log

for b/t: https://pastebin.com/H0jDYyUb

Proposed solution

I've considered several different solutions to this, but I saw there has been some anger caused by the split -- I assume this is the split in `commandHandlerClass.py' is the one?

This is why I am raising an issue, rather than going for an implementation right ahead, so please double-check my desired approach, before I spend the time:

  • lowercase the cmd
  • remove split, instead add a for c in cmd
  • check what screen we are on, before checking it's command list - btw, how would I go about doing that? I tried accessing uvm.site earlier, as it was referred to in another issue, but it seems like it isn't assigned at all -- kept returning None :D Shall I add that as well, while im at it?

Looking forward to hearing from y'all.

And thanks again for the warm reception on #69 (hehe)

Regards,
Chavdar

Clean up unused files in repo

There are a ton of unused code files still floating around in the src folder. It'd be great if someone could figure out what isn't being used anymore and remove those files.

Layout and Appearance

@sambattalio and @ginglis13 what do you guys think of the layout of the views. I’m starting to think that we could make a much better and more useful looking layout. Right now overlaying in a single pane looks nice but it doesn’t provide any extra utility. what are your thoughts on an appearance rewrite?

test of webhook

Issue and Steps to Reproduce

Version

Screenshots

Expected

Actual

Additional Details

  • Installed packages:

cannot run browser on python 3.5.3 -- update docs

Issue and Steps to Reproduce

Trying to run ./TerminusBrowser.py with python 3.5.3 gives the following error message:

$ ./TerminusBrowser.py Traceback (most recent call last):  File "./TerminusBrowser.py", line 14, in <module>    from Views.viewClass import View  File "src/Views/viewClass.py", line 4, in <module>    from Frames.defaultFrame import DefaultFrame  File "src/Frames/defaultFrame.py", line 9    self.footerStringRight = f''

Version

Python 3.5.3

Make history frame look better

Right now the history frame is kind of the bare minimum. It would be nice if the history frame included more information about what the particular object was, maybe if it was a thread include number of replies, or maybe a preview?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.