Git Product home page Git Product logo

quick-crawler-hun's Introduction

Simple webspider for crawling sites in Hungarian

A basic Python crawler based on the Hungarian NLP library, Lara that visits URLs and checks if a predefined set of keywords (ore their inflected forms) are present on these sites in Hungarian.

Ez egy egyszerű, magyarnyelvű webcrawler, ami ragozott formájú kulcsszavak meglétének vizsgálatára készült.

The following example searches for topics about Brexit on the given list of sites (the crawler will also follow links that have words like "külföldön", "kulfold", "gazdasági", "gazdasagos", "politikáról", "politikai", etc. in them either in the href=URL slug, or in between the <a>tags</a>):

This example checks articles on index.hu and hvg.hu:

from spider import QuickCrawler

match_sites = {
	"kulfold": [{"stem": "külföld", "wordclass": "noun"}],
	"gazdasag": [{"stem": "gazdaság", "wordclass": "noun"}],
	"politika": [{"stem": "politika", "wordclass": "noun"}],
}

match_keywords = {
	"anglia": [{"stem": "Anglia", "wordclass": "noun"},
                {"stem": "London", "wordclass": "noun"},
                {"stem": "brit", "wordclass": "adjective"}],
	"brexit": [{"stem": "Brexit", "wordclass": "noun"}]
}

if __name__ == "__main__":
	spider = QuickCrawler({"depth": 2}, match_keywords, match_sites)
	sites = ["www.index.hu", "www.hvg.hu"]
	for url, value in spider.crawl(sites):
		print(url, ', '.join(value))

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.