GithubHelp home page GithubHelp logo

medialab / hyphe Goto Github PK

View Code? Open in Web Editor NEW
319.0 31.0 59.0 93.85 MB

Websites crawler with built-in exploration and control web interface

Home Page: http://hyphe.medialab.sciences-po.fr/demo/

License: GNU Affero General Public License v3.0

Python 31.42% JavaScript 38.13% Shell 1.76% HTML 25.06% CSS 3.47% Dockerfile 0.16%

hyphe's Introduction

Hyphe: web corpus curation tool & links crawler

DOI SWH SWH

Welcome to Hyphe, a research-driven web crawler developped at the Sciences Po médialab for the DIME-SHS Web project (ANR-10-EQPX-19-01).

Hyphe aims at providing a tool to build web corpus by crawling data from the web and generating networks between what we call "web entities", which can be single pages as well as a website, subdomains or parts of it, or even a combination of those.

Demo & Tutos

You can try a limited version of Hyphe at the following url: http://hyphe.medialab.sciences-po.fr/demo/

You can find extensive tutorials on Hyphe's Wiki. See also these videos on how to grow a Hyphe corpus and what is a web entity.

How to install?

Before running Hyphe, you may want to adjust the settings first. The default config will work but you may want to tune it for your own needs. There is a procedure to change the configuration after the installation. However we recommend to take a look at the Configuration documentation for detailed explanation of each available option.

Warning: Hyphe can be quite disk-consuming, a big corpus with a few hundred crawls with a depth 2 can easily take up to 50GB, so if you plan on allowing multiple users, you should ensure at least a few hundreds gigabytes are available on your machine. You can reduce disk-space by setting to false the option store_crawled_html_content and limiting the max_depth allowed.

Migrating older versions

Hyphe has changed a lot in the past few years. Migrating from an older version by pulling the code from git is not guaranteed anymore, it is highly recommended to reinstall from scratch. Older corpora can be rebuilt by exporting the list of web entities from the old version and recrawl from that list of urls in the new Hyphe.

Easy install: using Docker

For an easy install either on Linux, Mac OS X or Windows, the best solution is to rely on Docker.

Docker enables isolated install and execution of software stacks, which helps installing easily a whole set of dependencies.

Docker's containers are sizeable: you should ensure at least 4GB of empty space is available before installing. In any case, as expressed above, for a regular and complete use of Hyphe, you should better ensure at least 100GB are available.

Note for Mac OS: you need Apple's XCode installed to allow Docker to run on Mac OS. (XCode is not required anymore for Docker, although it's always preferable to have it for other reasons, such as git etc.)

1. Install Docker

First, you should deploy Docker on your machine following its official installation instructions.

Once you've got Docker installed and running, you will need Docker Compose to set up and orchestrate Hyphe services in a single line. Docker Compose is already installed along with Docker on Windows and Mac OS X, but you may need to install it for Linux.

2. Download Hyphe

Collect Hyphe's sourcecode from this git repository (recommended way to benefit from future updates) or download and uncompress a zipped release, then enter the resulting directory:

git clone https://github.com/medialab/hyphe.git hyphe
cd hyphe

Or, if you do not have git (for instance on a Mac without XCode), you can also download and uncompress the files from Hyphe's latest release by clicking the link to "Source code (zip)" or "Source code (tar.gz)" from the following page: https://github.com/medialab/hyphe/releases

3. Configure

Then, copy the default configuration files and edit them to adjust the settings to your needs: WARNING: do not enclose the values with any kind of quotes

# use "copy" instead of "cp" under Windows powershell
cp .env.example .env
cp config-backend.env.example config-backend.env
cp config-frontend.env.example config-frontend.env

The .env file lets you configure:

  • TAG: the reference Docker image you want to work with among

    • prod: for the latest stable release
    • preprod: for intermediate unstable developments
    • A specific version, for instance 1.3.0. You will find the list on Hyphe's Docker Hub page and descriptions for each version on GitHub's releases page.
  • PUBLIC_PORT: the web port on which Hyphe will be served (usually 80 for a single service server, or for a shared host any other port you like which will need to be redirected)

  • DATA_PATH: using Hyphe can quickly consume several gigabytes of hard drive. By default, volumes will be stored within Docker's default directories but you can define your own path here.

    WARNING: DATA_PATH MUST be either empty, or a full absolute path including leading and trailing slashes (for instance /var/opt/hyphe/).

    It is not currently supported under Windows, and should always remain empty in this case (so you should install Hyphe from a drive with enough available space).

  • RESTART_POLICY: the choice of autorestart policy you want Hyphe containers to apply

    • no: (default) containers will not be restarted automatically under any circumstance
    • always: containers will always restart when stopped
    • on-failure: containers will restart only if the exit code indicates an on-failure error
    • unless-stopped: containers will always restart unless when explicitly stopped

    If you want Hyphe to start automatically at boot, you should use the always policy and make sure the Docker daemon is started at boot time with your service manager.

Hyphe's internal settings are adjustable within config-backend.env and config-frontend.env. Adjust the settings values to your needs following recommendations from the config documentation.

If you want to restrict Hyphe's access to a selected few, you should leave HYPHE_OPEN_CORS_API false in config-backend.env, and setup HYPHE_HTPASSWORD_USER & HYPHE_HTPASSWORD_PASS in config-frontend.env (use openssl passwd -apr1 to generate your password's encrypted value).

4. Prepare the Docker containers

You have two options: either collect, or build Hyphe's Docker containers.

  • Recommended: Pull our official preassembled images from the Docker Store

    docker-compose pull
  • Alternative: Build your own images from the source code (mostly for development or if you intend to edit the code, and for some very specific configuration settings):

    docker-compose build

Pulling should be faster, but it will still take a few minutes to download or build everything either way.

5. Start Hyphe

Finally, start Hyphe containers with the following command, which will run Hyphe and display all of its logs in the console until stopped by pressing Ctrl+C.

docker-compose up

Or run the containers as a background daemon (for instance for production on a server):

docker-compose up -d

Once the logs say "All tests passed. Ready!", you can access your Hyphe install at http://localhost:80/ (or http://localhost:<PUBLIC_PORT>/ if you changed the port value in the .env configuration file).

6. Stop and monitor Hyphe

To stop containers running in background, use docker-compose stop (or docker-compose down to also clean relying data).

You can inspect the logs of the various Docker containers using docker-compose logs, or with option -f to track latest entries like with tail.

Whenever you change any configuration file, restart the Docker container to take the changes into account:

docker-compose stop
docker-compose up -d

Run docker-compose help to get more explanations on any extra advanced use of Docker.

If you encounter issues with the Docker builds, please report an issue including the "Image ID" of the Docker images you used from the output of docker images or, if you installed from source, the last commit ID (read from git log).

7. Update to future versions

WARNING: Do not do this if you're not sure of what you're doing, upgrading to major new versions can potentially break your existing corpuses making it really complex to get your data back.

If you installed from git by pulling our builds from DockerHub, you should be able to update Hyphe to future minor releases by simply doing the following:

docker-compose down
git pull
docker-compose pull
# eventually edit your configuration files to use new options
docker-compose up -d

Manual install (complex and only for Linux)

If your computer or server relies on an old Linux distribution unable to run Docker, if you want to contribute to Hyphe's backend development, or for any other personal reason, you might want to rather install Hyphe manually by following the manual install instructions.

Please note there are many dependencies which are not always trivial to install and that you might run in quite a bit of issues. You can ask for some help by opening an issue and describing your problem, hopefully someone will find some time to try and help you.

Hyphe relies on a web interface with a server daemon which must be running at all times. When manually installed, one must start, stop or restart the daemon using the following command (without sudo):

bin/hyphe <start|restart|stop> [--nologs]

By default the starter will display Hyphe's log in the console using tail. You can use Ctrl+C whenever you like to stop displaying logs without shutting Hyphe down. Use the --nologs option to disable logs display on start. Logs are always accessible from the log directory.

All settings can be configured directly from the global configuration file config/config.json. Restart Hyphe afterwards to take changes into account: bin/hyphe restart.

Serve Hyphe on the web

As soon as the Docker containers or the manual daemon start, you can use Hyphe's web interface on your local machine at the following url:

For personal uses, you can already work with Hyphe as such. Although, if you want to let others use it as well (typically if you installed on a distant server), you need to serve it on a webserver and make a few adjustments.

Read the dedicated documentation to do so.

Advanced developers features & contributing

Please read the dedicated Developers documentation and the API description.

What's next?

See our roadmap!

Papers & references

Tutorials / examples

Publications about Hyphe

  • OOGHE-TABANOU, Benjamin, JACOMY, Mathieu, GIRARD, Paul & PLIQUE, Guillaume, "Hyperlink is not dead!" (Proceeding / Slides), In Proceedings of the 2nd International Conference on Web Studies (WS.2 2018), Everardo Reyes, Mark Bernstein, Giancarlo Ruffo, and Imad Saleh (Eds.). ACM, New York, NY, USA, 12-18. DOI: https://doi.org/10.1145/3240431.3240434

  • PLIQUE, Guillaume, JACOMY, Mathieu, OOGHE-TABANOU, Benjamin & GIRARD, Paul, "It's a Tree... It's a Graph... It's a Traph!!!! Designing an on-file multi-level graph index for the Hyphe web crawler". (Video / Slides) Presentation at the FOSDEM, Brussels, BELGIUM, February 3rd, 2018.

  • JACOMY, Mathieu, GIRARD, Paul, OOGHE-TABANOU, Benjamin, et al, "Hyphe, a curation-oriented approach to web crawling for the social sciences.", in International AAAI Conference on Web and Social Media. Association for the Advancement of Artificial Intelligence, 2016.

Publications using Hyphe

Credits & License

Mathieu Jacomy, Benjamin Ooghe-Tabanou & Guillaume Plique @ Sciences Po médialab

Discover more of our projects at médialab tools.

This work is supported by DIME-Web, part of DIME-SHS research equipment financed by the EQUIPEX program (ANR-10-EQPX-19-01).

Hyphe is a free open source software released under AGPL 3.0 license.

Thanks to https://www.useragents.me for maintaining a great updated list of common user agents which are reused within Hyphe!

[...] I hear _kainos_ [(greek: "now")] in the sense of thick, ongoing presence, with __hyphae__ infusing all sorts of temporalities and materialities."

Donna J. Haraway, Staying with the Trouble, Making kin with the Chthlucene p.2

hyphe's People

Contributors

2lama avatar annelhote avatar boogheta avatar cvuiller avatar dependabot[bot] avatar diegantobass avatar farjasju avatar gmlewis avatar heikkidoeleman avatar jacomyma avatar jrault avatar jri-sp avatar mydu avatar pablohoffman avatar paulgirard avatar pipojojo avatar ptbrowne avatar rouxrc avatar stijn-uva avatar thom4parisot avatar yomguithereal 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hyphe's Issues

. in webentity

When you make a crawl from a url list (i haven't tested the normal crawl) and there is a dot in the end of a url (e.g. www.domain.com . ) the backend server crashes and the entire import has to be repeated.

It is an important bug because DMI link harvester from time to time leaves you with dots in the end of the url.

Crawl list features

Useful things to add :

  • display details of a crawl within the screen when selecting a crawl down in the list so we can see them without scrolling back to the top
  • checkbox to show all "suspect" crawls meaning those "finished" but with small pages/links figures (i.e less than 4 for both?)
  • while stille in debug, having the crawljob id on the right is useful, but the webentity_id is more often needed so should be there as well
  • add link to recrawl the same webentity
  • add a link to the webentity page (edit) corresponding to a crawl

hyphe_backend.lib missing

Hi Medialab,

Running sudo bin/deploy_scrapy_spider.sh to install the latest edition of hypher gives me the following error:

Copying config.json from root directory to hyphe_backend/crawler for scrapy deployment...
Traceback (most recent call last):
File "deploy.py", line 18, in
from hyphe_backend.lib import config_hci
ImportError: No module named hyphe_backend.lib

It appears that a file most be missing.

Best regards
Tobias

Bug in store.get_webentity_by_url possibly linked to HTTPS

I have a case where the right web entity is not fetched. This is my exact case:

  • I have a generic web entity "Twitter HTTPS" prefixed by https://twitter.com:443
  • I have a more precise web entity "XXX on Twitter" prefixed by https://twitter.com/xxx
  • I have a this URL: 'https://twitter.com/xxx'
    Note that this URL is exactly the prefix of "XXX on Twitter". But when I ask to fetch the right web entity, it is the other one that is returned: "Twitter HTTPS".

The right web entity is not returned, a more generic one is instead.

Fix recognition of url in webentity with trailing slashes

Examples:
./hyphe_backend/test_client.py store.declare_webentity_by_lru_prefix_as_url http://www.test.fr/test/
./hyphe_backend/test_client.py store.get_webentity_by_url http://www.test.fr/test #FAIL ?
./hyphe_backend/test_client.py store.get_webentity_by_url http://www.test.fr/test/ #OK
./hyphe_backend/test_client.py store.get_webentity_by_url http://www.test.fr/test/a #FAIL

./hyphe_backend/test_client.py store.declare_webentity_by_lru_prefix_as_url http://www.test2.fr/test2
./hyphe_backend/test_client.py store.get_webentity_by_url http://www.test2.fr/test2 #OK
./hyphe_backend/test_client.py store.get_webentity_by_url http://www.test2.fr/test2/ #OK
./hyphe_backend/test_client.py store.get_webentity_by_url http://www.test2.fr/test2/a #OK

Possibility to specify in configuration an Analytics ID

It might be nice to monitor who accesses the crawler interface through a Google Analytics account.

To do that, the best would be to have behavioral tracking in the interface, but with an ID specifiable in the global instance configuration.

. in webentity

When you make a crawl from a url list (i haven't tested the normal crawl) and there is a dot in the end of a url (e.g. www.domain.com . ) the backend server crashes and the entire import has to be repeated.

It is an important bug because DMI link harvester from time to time leaves you with dots in the end of the url.

Pressing Enter instead of clicking "Declare" returns an error on Crawl_new

When declaring a new crawl in crawl_new.php by inputting a new url, if we do Enter with the keyboard instead of clicking on the "Declare" button, it does not work and the Chrome console displays :
Uncaught TypeError: Object # has no method 'get' _page_crawl_new.js:618
(anonymous function) _page_crawl_new.js:618
p.event.dispatch jquery.min.js:2
g.handle.h

CSS error in Remove page to crawl

Using Google chrome Mac it is nearly imposible to remove pages you have added (see attached image). It appears to be a simple css error but I haven't been able to track it down.
screenshot_6_8_13_9_11_am

Loading the interface when the server is off

Since the interface (served by Apache) can be loaded when the server is off, it could be nice to have a specific interface reaction instead of an error message (especially since it is not really an error, at least not an unknown one).

Remove Abort Crawl button when crawl finished

It does not make much sense to be still able to cancel a crawl even when the crawling and indexing are already over.

Changing the button into another one to "recrawl" could be a nice feature

Web entities and crawl limits

This is less of a bug report and more of an attempt to open the discussion.
Currently the limits of a web entities and the limits of its crawl coincide. This is probably a good idea in most cases, but not necessarily in all cases.

Example:
In our cartography of the climate adaptation debate, we have to deal with the website of the Food and Agriculture Organisation. Of course, we don't want crawl this entire website because it is too big and only a portion of it directly concerns climate adaptation. In fact, we are lucky, because they have a sub-directory that is dedicated to climate change (http://www.fao.org/climatechange/). Great! so we only want to crawl this directory.
Still, this does not necessarily imply that we only want to limit this entity to this folder. In fact, the FAO is a relatively unitary institution. Someone who want to cite a FAO study for example may as well site the homepage of the FAO website and not necessarily the pages in the sub-directory.

What this example tries to illustrate is that sometime we might want to define a larger web-entity, but only crawl a smaller portion of it (without necessarily reduce the size of the web-entity).
Could we think of a way to do this?

Exclude button in the list

I know that it is possible to enter in the editing window of a web entity to exclude it. Still, since this is an operation that is done frequently and often just by looking at the URL of the site, it'd be much easier to it directly in the list.

Actualisation de page

Chaque fois que je tente d'actualiser, j'obtiens ça : (je suis alors obligé de rouvrir le site dans une nouvelle fenetre (chrome)
image

Header menu

It would be nice if the "Hyphe" on the left of the header could link to the home page.

Also the "Webentities" menu could point also to the "Explore discovered entities" page, and the "Crawl" menu to the "crawl list" page.

Sort discovered entities by in-degree

I've given a look a the interface and to me the n°1 priority for the user interface is the possibility to sort the discovered web entities for decreasing in-degree.
Of course it is possible to export the graph, sort in Gephi and then get back to Hyphe to crawl the most cited neighbors...
but how nicer would it be to do it without leaving the interface.

Thrift 0.8.0 compilation

Add --without-erlang to the thrift ./configure. Otherwise, the compilation won't succeed on Ubuntu and such.

Need a page to make a real search

The list of webentities is slow and it comes from that fact that it loads all webentities. It would be useful to have a page where to search web entities from Lucence. It would be more efficient. It would be the occasion to attach features to groups of web entities (group tag, group classify, group merge...)

Redirection in iframe

Framebreakers get rid of the iframe preview. We want to avoid that.

hint: use onbeforeunload ?

Handle past crawls on removed/merged webentities

When a webentity has been crawled and is merged into another one, its ID no longer corresponds to a webentity in the whole list so it crashes the display of its name in the crawl list (crawl.php).

Either remove those from the crawl list or handle them differently, maybe we need to keep a record of merged ids to their merged_into ones?

Modifying list of tag values for a category always updates the tags of the last category

For instance, if we try to modify the values of the tags of the category A or C here, it impacts the tags in category B without affecting the others : http://jiminy.medialab.sciences-po.fr/hyphe-demo/webentity_edit.php#we_id=ed90cc14-4dc1-422d-b388-c1bbfaa38e76

Looking at the code, it looks like the category variable is only grabbed when trying to update the category name, so the latest category is being used

Download button in Network

Pu the button just below the selected radio button, so that it is clear that we download what is selected

Alert boxes on some pages when no data yet

After resetting, if one clicks on the "network of WEs" or "explore discovered WEs" links, the webpages complain with a popup alert box because there is no data yet, this should probably just be a less invasive simple message on the pages.

Installations script

Hi Medialab,

Congratulations with your new release - hypher just seems to become better and better.

Today I experimented for the first time with your bin/install.sh script in which I encountered two minor problems:

  1. Since my first attempt of installation failed (quite a common problem) i had to run the installation script again. This time I however got some new errors whenever I reached these two lines:

sudo ln -s pwd/config/scrapyd.config /etc/scrapyd/conf.d/100-hyphe || exit 1
sudo ln -s pwd/hyphe_www_client/_config/apache2.conf /etc/apache2/sites-available/hyphe || exit 1

The script had already been run once the files already existed and the script died with an error. One should in other words add some if-check to see if the symbolic link already exists.

  1. The scripts currently ends with the following text: "You can now run bash bin/start.sh and access Hyphe at http://localhost/hyphe". I however kept encountering an error until i finally realised that bash bin/build_thrift.sh is not included in the install script and had to be run manually.

Maybe this could be added as well or the end text of the install script could simply be changed.

Best regards
Tobias

Handle websites giving wrong http statuses

Some websites act in weird manners, we need to establish policies for these.
For instance:

Downloadable CSV

Possibility to download a CSV, in the list of web entities, the crawl jobs, and the classification of discovered web entities

Handle multiple corpora in one single instance

  • create/close/export corpus with specific settings (WE Creation Rule, crawl strategy(?), max_depth, precision limit)
  • Adapt core/crawler code to specific corpora
  • Run/Stop one MemoryStructure JAVA instance per corpus from core on demand and close on inactive
  • limit number of corpus running simultanuously

Handle www in prefixes

If http://test.fr is created before http://www.test.fr, the latter falls naturally into the first's prefix and is therefore never created as a prefix, whereas it is if they are created in the reverse order.

Possible options :

  • handle from webentity creation rule ?
  • always strip www ?
  • always create www extra when missing ?

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.