Giter VIP home page Giter VIP logo

auto-indexer's Introduction

auto-indexer

An auto-indexer for a small FPT web page. Made for me to download file in http://inst.eecs.berkeley.edu/~cs61b/fa16/hw

Usage

# Simpile step:
>>> auto_indexer("http://init-url.com")
# Print many things
0
# File will be downloaded

# Specific process:
>>> init-wepage = Webpage("http://init-url.com", True)
>>> web = Website(init-webpage)
>>> web
Website(Webpage("http://init-url.com"))
>>> web = web.get_subwebsite()
# Will print webpage url and how many subpage in it
>>> web
Website(Webpage("http://init-url.com"),[Website(Webpage("code")), Website(Webpage("homework"
), [Website(Webpage("hw01")), Website(Webpage("hw02"))])])
>>> web.download()
# Will print downloaded file url
0
# File will be downloaded

Problem

  • Website.download() is not finish. Now it will only download to current folder.
  • Create folder with no content as a file (intentionally).
  • Cannot use in shell as python3 auto-indexer [website] [path] (not yet finish).

How does it work

I do not know how others auto-indexer work. This is just how I think an auto-index can work.

Each webpage is a Webpage instance, and can form a Website tree as Website(webpage, subwebpages). For given initial webpage, Website.get_subwebsite() will recursively form a whole website tree as following step:

  1. Website.get_subwebsite() ask webpage to give its subpages as a list

  2. When webpage need to return its subpages, webpage first get whatever in the url, and than ask a HTML interpreter to interpret it.

  3. HTML interpreter will interpret the web page. It will read the page, and for each tag (since we only want to know the link in the tag.), it return a HTMLTag object. Than interpreter eval this object and return Webpage object.

  4. After finish interpret the webpage, interpreter will return all Webpage object it creates as a list

  5. Webpage return its link to Website.get_subwebsite()

  6. for each subwebpage, subwebpage.get_subwebsite()

auto-indexer's People

Contributors

xueqili avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.