Giter VIP home page Giter VIP logo

geeksforgeeksscrapper's Introduction

GeeksForGeeksScrapper

Scrapes GeeksForGeeks and creates html & PDF for chosen category along with syntax highlighting for the code.

Screenshots

Example of articles of C category as html:

alt tag

Example of articles of C category as pdf:

alt tag

Installation

To use the scrapper, install the following:

$ sudo apt-get install wkhtmltopdf

Then create venv

$ virtualenv /path/to/g4g-env

Switch to venv

$ source /path/to/g4g-env/bin/activate

Now install BeautifulSoup as:

$ pip install beautifulsoup4

or via package manager as:

$ sudo apt-get install python-bs4

or for Python dependencies, you can just install via requirements.txt inside the virtual environment.

$ pip install -r requirements.txt

Run the G4G_Scrapper

$ python g4g.py

Choose the category you want to scrape from the menu and wait for the magic to happen :)

You can find the output as G4G_<category_name>.html and G4G_<category_name>.pdf in the same directory.

Disclaimer: This is strictly for educational purpose only. Author will not be liable for anything, what so ever; you do with this script.

geeksforgeeksscrapper's People

Contributors

curiouslearner avatar geniuslearner avatar nsparatkar avatar vishalrohra 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  avatar  avatar  avatar

geeksforgeeksscrapper's Issues

problem in scrapping algorithms section

Scraping link no: 244 Link: http://www.geeksforgeeks.org/count-number-of-bits-to-be-flipped-to-convert-a-to-b/
Traceback (most recent call last):
File "g4g.py", line 106, in
scrape_category(categoryUrl)
File "g4g.py", line 82, in scrape_category
link_soup = BeautifulSoup(requests.get(link).text)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 49, in request
response = session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 567, in send
adapter = self.get_adapter(url=request.url)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 646, in get_adapter
raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for ' http://www.geeksforgeeks.org/count-number-of-bits-to-be-flipped-to-convert-a-to-b/'

Use of Template Rendering library to seprate the Python and HTML Code

The Current Script to scrape the website contains both python as well as the HTML code . Thus in order to scale the project i.e to modify the HTML code to redesign the Web Page and PDF document, we may need to modify the Script also. Thus it will great to use a template rendering library like Jinja2 to render the HTML content so that the HTML and Python Part Can be separated.

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.