Git Product home page Git Product logo

cli-browser's Introduction

CLI-Browser

Simulates the behaviour of a Web Browser regarding the management of Web Pages and tabs using a Stack and a Queue Data Structures.

The tabs are stored using linked lists, so that a new tab is always the last element of the list and the first deleted tab will always be the last element of the list.

The Global History is stored using a Generic Queue data structure, and the Downloads queue is implemented using a Priority Queue, the priority of an element being decided by the remaining bytes to be downloaded (generated randomly).

The Back and Forward actions relative to a Tab are stored using a Stack data structure.

Available Commands:

  • set_band - sets the download speed (default: 1 KBps)
  • newtab - adds a new empty tab to the tabs list
  • deltab - deletes the last added tab
  • change_tab <tab_index> - navigates to the specified indexed tab
  • print_open_tabs
  • goto - accesses the web page given by
  • back/forward - navigating through the Back/Forward Stacks
  • history - prints the current global history
  • del_history <nr_entries> - deletes the specified number of entries from the global history (del_history 0 to delete it all)
  • downloads - prints the current state of the Downloads Queue
  • list_dl - prints the downloadable resources that the current web page offers
  • download <index_resource> - adds to the Priority Queue the resource with the specified index, from the current Web Page
  • wait - advances the downloads' current stage with specified time

Usage Example:
./CLIB in_file out_file

in_file:
set_band 102400
goto URL1
goto URL2
list_dl
download 1
downloads
newtab
goto URL3
change_tab 0
goto URL4
newtab
goto URL5
print_open_tabs
list_dl
download 2
deltab
downloads
print_open_tabs
wait 25
downloads

out_file:
[0 - "URL2-(0)" : 86570845]
[1 - "URL2-(1)" : 7927001]
[2 - "URL2-(2)" : 62482]
[3 - "URL2-(3)" : 76084628]
[4 - "URL2-(4)" : 5305591]
[5 - "URL2-(5)" : 21035621]
[6 - "URL2-(6)" : 13171437]
["URL2-(1)" : 7927001/7927001]
(0: URL4)
(1: URL3)
(2: URL5)
[0 - "URL5-(0)" : 76084628]
[1 - "URL5-(1)" : 5305591]
[2 - "URL5-(2)" : 21035621]
[3 - "URL5-(3)" : 13171437]
...
["URL2-(1)" : 7619801/7927001]
["URL5-(2)" : 21035621/21035621]
(0: URL4)
(1: URL3)
["URL2-(1)" : 5059801/7927001]
["URL5-(2)" : 21035621/21035621]

cli-browser's People

Contributors

mogasergiu avatar

Watchers

 avatar

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.