Git Product home page Git Product logo

crawler's Introduction

Crawler

Distributed webpage crawler making use of Husky

import sys import re import json import bs4

from Crawler import crawler_dist as cd from Crawler import crawler_config import bindings.frontend.env as env

def parse_name(url, html): try: soup = bs4.BeautifulSoup(html, "lxml") content = soup.find("div", {"class" : "healthaz-header"}).text.strip() return json.dumps({"name": content.split('\n')[0], "url": url}) except: sys.stderr.write('parse failed: ' + url + '\n') return json.dumps({"url": url})

config = crawler_config.CrawlerConfig()

config.urls_init=['http://www.nhs.uk/Conditions/Pages/BodyMap.aspx?Index=A']

config.set_rules_include(['http://www.nhs.uk/conditions/[a-zA-Z- ]+'])

config.add_parse_handler('http://www.nhs.uk/conditions/[a-zA-Z\- ]+', parse_name)

config.hdfspath_output = '/datasets/crawl/nhs-new-A2/'

config.group_url = 5

config.max_retry_time = 10

config.conn_timeout = 100

config.read_timeout = 100

config.tor_port_list = range(18112, 18161)

config.port_switch_threshold = 5.0

config.num_iters = 2

env.pyhusky_start() cd.crawler_run(config)

crawler's People

Contributors

benben1026 avatar

Watchers

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