webpager

Paginating the web

  • Owner: scrapinghub/webpager
  • Platform:
  • License::
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

Webpager

A simple library to classify if an anchor on HTML page is a pagination link or not.

Installation

Clone the repository, then install package requirements
(package requires lxml, scikit-learn)::

$ pip install -r requirements.txt

then install package itself::

$ python setup.py install

Usage

Get a HTML page somewhere.::

>>> from urllib import urlopen
>>> url = 'http://www.tripadvisor.com/Restaurant_Review-g294217-d3639657-Reviews-Trattoria_Caffe_Monteverdi-Hong_Kong.html'
>>> html = urlopen(url).read()

Load web pager and classify.::

>>> from webpager import WebPager
>>> webpager = WebPager()
>>> for anchor, label in webpager.paginate(html, url):
>>>     if label:
>>>	         print anchor.get('href')

http://www.tripadvisor.com/Restaurant_Review-g294217-d3639657-Reviews-or10-Trattoria_Caffe_Monteverdi-Hong_Kong.html#REVIEWS
http://www.tripadvisor.com/Restaurant_Review-g294217-d3639657-Reviews-or40-Trattoria_Caffe_Monteverdi-Hong_Kong.html#REVIEWS
http://www.tripadvisor.com/Restaurant_Review-g294217-d3639657-Reviews-or10-Trattoria_Caffe_Monteverdi-Hong_Kong.html#REVIEWS

Training

see train.ipynb_ for more details.

.. _train.ipynb: http://nbviewer.ipython.org/github/scrapinghub/webpager/blob/master/train.ipynb

Main metrics

Overview
Name With Ownerscrapinghub/webpager
Primary LanguageC
Program languagePython (Language Count: 2)
Platform
License:
所有者活动
Created At2013-08-16 09:54:24
Pushed At2014-02-11 08:52:23
Last Commit At2014-02-11 16:52:09
Release Count0
用户参与
Stargazers Count37
Watchers Count129
Fork Count12
Commits Count15
Has Issues Enabled
Issues Count1
Issue Open Count1
Pull Requests Count1
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private