{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Environment Setup" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from os import path as p, chdir\n", "\n", "if 'examples' in p.abspath('.'):\n", " chdir('..')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Examples" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Fetch a webpage" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "In this example, we fetch the title of a webpage." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{'content': b'Hacker News'}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from riko.modules.fetchpage import pipe\n", "\n", "url = 'https://news.ycombinator.com/'\n", "next(pipe(conf={'url': url, 'start': '