Skip to content
sample1.ipynb 7.71 KiB
Newer Older
onbpre's avatar
onbpre committed
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "import necessary modules"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "import json\n",
    "import time"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "load metadata files from Webarchive Austria"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "\n",
    "selective_crawls = requests.get('https://webarchiv.onb.ac.at/data/selective.json').json()\n",
    "event_crawls = requests.get('https://webarchiv.onb.ac.at/data/events.json').json()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now you can extract metadata from these files"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Show the names and dates of all crawls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
Andreas's avatar
Andreas committed
      "Selective Crawls\n",
      "\n",
      "Frau/Gender\n",
      "Politikkollektion\n",
      "Medienkollektion\n",
      "\n",
      "Event Crawls\n",
      "\n",
      "100 Jahre Republik 2018\n",
      "EU-Ratsvorsitz 2018\n",
      "Bundespräsidenten-Wahl 2016\n",
      "Flüchtlingskrise 2015\n",
      "Song Contest 2015\n",
      "Erster Weltkrieg 2014\n",
      "EU-Wahl 2014\n",
      "Olympia 2014\n",
      "Olympia 2010\n",
      "Bundespräsidenten-Wahl 2010\n",
      "EU-Wahl 2009\n"
onbpre's avatar
onbpre committed
     ]
    }
   ],
   "source": [
    "print('Selective Crawls\\n')\n",
    "for crawl in selective_crawls:\n",
    "    print(crawl['name'])\n",
    "print('\\nEvent Crawls\\n')\n",
    "for crawl in event_crawls:\n",
    "    print(crawl['name'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Show all seeds of Song Contest 2015 event"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
Andreas's avatar
Andreas committed
      "http://conchitawurst.com\n",
      "http://conchitawurst.com/news/\n",
      "http://de.wikipedia.org/wiki/Eurovision_Song_Contest_2015\n",
      "http://de.wikipedia.org/wiki/The_Makemakes\n",
      "http://debatte.orf.at/stories/1754300/\n",
      "http://derstandard.at/r2000004087668/Song-Contest-2015\n",
      "http://derstandard.at/r2000015639396/Eurovisions---Song-Contest-Blog\n",
      "http://diepresse.com/home/kultur/songcontest/index.do\n",
      "http://goodnight.at/magazin/kultur/516-60-eurovision-songcontest-in-wien\n",
      "http://kundendienst.orf.at/programm/fernsehen/orf1/songcontest2015.html\n",
      "http://kurier.at/kultur/song-contest\n",
      "http://medienportal.univie.ac.at/uniview/forschung/detailansicht/artikel/song-contest-zwischen-pop-und-politik/\n",
      "http://oe3.orf.at/stories/2679710\n",
      "http://orf.at/\n",
      "http://orf.at/stories/2254095/\n",
      "http://orf.at/stories/2254095/2254088/\n",
      "http://orf.at/stories/2254095/2254098/\n",
      "http://songcontest.orf.at/\n",
      "http://steiermark.orf.at/news/stories/2684488/\n",
      "http://tvthek.orf.at/topic/Eurovision-Song-Contest-2015/9137507\n",
      "http://tvthek.orf.at/topic/Oesterreich-beim-Song-Contest/9174892\n",
      "http://wien.orf.at/news/stories/2648040/\n",
      "http://wien.orf.at/news/stories/2648857/\n",
      "http://wien.orf.at/news/stories/2649515/\n",
      "http://wien.orf.at/news/stories/2661128/\n",
      "http://wien.orf.at/news/stories/2661370/\n",
      "http://wien.orf.at/news/stories/2661798/\n",
      "http://wien.orf.at/news/stories/2661804/\n",
      "http://wien.orf.at/news/stories/2661845/\n",
      "http://wien.orf.at/news/stories/2661855/\n",
      "http://wien.orf.at/news/stories/2661910/\n",
      "http://wien.orf.at/news/stories/2662093/\n",
      "http://wien.orf.at/news/stories/2662947/\n",
      "http://wien.orf.at/news/stories/2663106/\n",
      "http://wien.orf.at/news/stories/2664083/\n",
      "http://wien.orf.at/news/stories/2666541/\n",
      "http://wien.orf.at/news/stories/2666581/\n",
      "http://wien.orf.at/news/stories/2668462/\n",
      "http://wien.orf.at/news/stories/2670490/\n",
      "http://wien.orf.at/news/stories/2676170/\n",
      "http://wien.orf.at/news/stories/2678309/\n",
      "http://wien.orf.at/news/stories/2679672/\n",
      "http://wien.orf.at/news/stories/2680454/\n",
      "http://wien.orf.at/news/stories/2682245/\n",
      "http://wien.orf.at/news/stories/2683703/\n",
      "http://wien.orf.at/news/stories/2684423/\n",
      "http://wien.orf.at/news/stories/2687164/\n",
      "http://wien.orf.at/news/stories/2706977/\n",
      "http://wien.orf.at/news/tags/esc\n",
      "http://www.apa.at/Site/ESC2015/index.html\n",
      "http://www.austria-trend.at/blog/\n",
      "http://www.bmlfuw.gv.at/umwelt/nachhaltigkeit/green-events/projekte/kultur_und_musik/green_song_contest.html\n",
      "http://www.eurovision.tv/\n",
      "http://www.heute.at/song+contest./\n",
      "http://www.krone.at/song-contest\n",
      "http://www.news.at/a/song-contest-telegramm-2015\n",
      "http://www.oe24.at/kultur/song-contest\n",
      "http://www.oeticket.com/de/kuenstler/eurovision-song-contest-1020/profile.html\n",
      "http://www.picturedesk.com/ESC2015\n",
      "http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015\n",
      "http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-family-show-finale.html\n",
      "http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-jury-show-finale.html\n",
      "http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-public-viewing-in-wien.html\n",
      "http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-semifinale-1-2.html\n",
      "http://www.songcontest.at/\n",
      "http://www.stadthalle.com/de/schauen/events/75/Eurovision-Song-Contest\n",
      "http://www.vienna.at/specials/eurovision-song-contest\n",
      "http://www.wien-event.at/events/song-contest/\n",
      "http://www.wien-ticket.at/de/service/Eurovision-Song-Contest-Wiener-Stadthalle-Wien\n",
      "http://www.wien.info/de/musik-buehne/eurovision-song-contest\n",
      "http://www.wienerlinien.at/eportal2/ep/tab.do/pageTypeId/74690\n",
      "http://www.wienerzeitung.at/dossiers/eurovision_song_contest_2015/\n",
      "https://instagram.com/esc_buildingbridges/\n",
      "https://instagram.com/themakemakes/\n",
      "https://twitter.com/ESC2015ORF\n",
      "https://twitter.com/Eurovision\n",
      "https://twitter.com/hashtag/eurovision?src=hash\n",
      "https://www.facebook.com/ESCBuildingBridges\n",
      "https://www.facebook.com/EurovisionSongContest\n",
      "https://www.facebook.com/themakemakes\n",
      "https://www.stadthalle.com/de/schauen/events/75/Eurovision-Song-Contest\n",
      "https://www.wien.gv.at/kultur/esc/\n"
onbpre's avatar
onbpre committed
     ]
    }
   ],
   "source": [
    "for crawl in event_crawls:\n",
    "    if crawl['name'] == 'Song Contest 2015':\n",
    "        for group in crawl['groups']:\n",
    "            for seed in group['seeds']:\n",
    "                print(seed)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
Andreas's avatar
Andreas committed
   "display_name": "Python 3",
onbpre's avatar
onbpre committed
   "language": "python",
Andreas's avatar
Andreas committed
   "name": "python3"
onbpre's avatar
onbpre committed
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
Andreas's avatar
Andreas committed
    "version": 3
onbpre's avatar
onbpre committed
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
Andreas's avatar
Andreas committed
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
onbpre's avatar
onbpre committed
  }
 },
 "nbformat": 4,
Andreas's avatar
Andreas committed
 "nbformat_minor": 1
onbpre's avatar
onbpre committed
}