sample4.ipynb 8.64 KB
Newer Older
Andreas's avatar
Andreas committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import requests\n",
    "import json\n",
    "import time\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a WebarchivSession Object with convenience methods for easy access with your API-Key "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from webarchiv import WebarchivSession\n",
    "\n",
Andreas's avatar
Andreas committed
36
    "apikey = '2pm8i0hnmpcTK4Oj4CUeBoZd7vywrm4c'\n",
Andreas's avatar
Andreas committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    "w = WebarchivSession(apikey)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "load metadata files from Webarchive Austria"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "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": [
    "Get the number of captures of all seeds of the Event Crawl Song Contest 2015"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
Andreas's avatar
Andreas committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
      "74  Captures for  http://conchitawurst.com\n",
      "8  Captures for  http://conchitawurst.com/news/\n",
      "6  Captures for  http://de.wikipedia.org/wiki/Eurovision_Song_Contest_2015\n",
      "5  Captures for  http://de.wikipedia.org/wiki/The_Makemakes\n",
      "32  Captures for  http://debatte.orf.at/stories/1754300/\n",
      "59  Captures for  http://derstandard.at/r2000004087668/Song-Contest-2015\n",
      "32  Captures for  http://derstandard.at/r2000015639396/Eurovisions---Song-Contest-Blog\n",
      "238  Captures for  http://diepresse.com/home/kultur/songcontest/index.do\n",
      "5  Captures for  http://goodnight.at/magazin/kultur/516-60-eurovision-songcontest-in-wien\n",
      "32  Captures for  http://kundendienst.orf.at/programm/fernsehen/orf1/songcontest2015.html\n",
      "150  Captures for  http://kurier.at/kultur/song-contest\n",
      "11  Captures for  http://medienportal.univie.ac.at/uniview/forschung/detailansicht/artikel/song-contest-zwischen-pop-und-politik/\n",
      "32  Captures for  http://oe3.orf.at/stories/2679710\n",
      "9976  Captures for  http://orf.at/\n",
      "32  Captures for  http://orf.at/stories/2254095/\n",
      "33  Captures for  http://orf.at/stories/2254095/2254088/\n",
      "33  Captures for  http://orf.at/stories/2254095/2254098/\n",
      "1383  Captures for  http://songcontest.orf.at/\n",
      "35  Captures for  http://steiermark.orf.at/news/stories/2684488/\n",
      "32  Captures for  http://tvthek.orf.at/topic/Eurovision-Song-Contest-2015/9137507\n",
      "32  Captures for  http://tvthek.orf.at/topic/Oesterreich-beim-Song-Contest/9174892\n",
      "35  Captures for  http://wien.orf.at/news/stories/2648040/\n",
      "38  Captures for  http://wien.orf.at/news/stories/2648857/\n",
      "42  Captures for  http://wien.orf.at/news/stories/2649515/\n",
      "36  Captures for  http://wien.orf.at/news/stories/2661128/\n",
      "43  Captures for  http://wien.orf.at/news/stories/2661370/\n",
      "39  Captures for  http://wien.orf.at/news/stories/2661798/\n",
      "43  Captures for  http://wien.orf.at/news/stories/2661804/\n",
      "40  Captures for  http://wien.orf.at/news/stories/2661845/\n",
      "38  Captures for  http://wien.orf.at/news/stories/2661855/\n",
      "43  Captures for  http://wien.orf.at/news/stories/2661910/\n",
      "36  Captures for  http://wien.orf.at/news/stories/2662093/\n",
      "44  Captures for  http://wien.orf.at/news/stories/2662947/\n",
      "45  Captures for  http://wien.orf.at/news/stories/2663106/\n",
      "40  Captures for  http://wien.orf.at/news/stories/2664083/\n",
      "40  Captures for  http://wien.orf.at/news/stories/2666541/\n",
      "45  Captures for  http://wien.orf.at/news/stories/2666581/\n",
      "44  Captures for  http://wien.orf.at/news/stories/2668462/\n",
      "40  Captures for  http://wien.orf.at/news/stories/2670490/\n",
      "39  Captures for  http://wien.orf.at/news/stories/2676170/\n",
      "36  Captures for  http://wien.orf.at/news/stories/2678309/\n",
      "37  Captures for  http://wien.orf.at/news/stories/2679672/\n",
      "37  Captures for  http://wien.orf.at/news/stories/2680454/\n",
      "34  Captures for  http://wien.orf.at/news/stories/2682245/\n",
      "39  Captures for  http://wien.orf.at/news/stories/2683703/\n",
      "94  Captures for  http://wien.orf.at/news/stories/2684423/\n",
      "105  Captures for  http://wien.orf.at/news/stories/2687164/\n",
      "53  Captures for  http://wien.orf.at/news/stories/2706977/\n",
      "287  Captures for  http://wien.orf.at/news/tags/esc\n",
      "120  Captures for  http://www.apa.at/Site/ESC2015/index.html\n",
      "65  Captures for  http://www.austria-trend.at/blog/\n",
      "6  Captures for  http://www.bmlfuw.gv.at/umwelt/nachhaltigkeit/green-events/projekte/kultur_und_musik/green_song_contest.html\n",
      "832  Captures for  http://www.eurovision.tv/\n",
      "151  Captures for  http://www.heute.at/song+contest./\n",
      "65  Captures for  http://www.krone.at/song-contest\n",
      "32  Captures for  http://www.news.at/a/song-contest-telegramm-2015\n",
      "344  Captures for  http://www.oe24.at/kultur/song-contest\n",
      "18  Captures for  http://www.oeticket.com/de/kuenstler/eurovision-song-contest-1020/profile.html\n",
      "32  Captures for  http://www.picturedesk.com/ESC2015\n",
      "5  Captures for  http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015\n",
      "5  Captures for  http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-family-show-finale.html\n",
      "5  Captures for  http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-jury-show-finale.html\n",
      "5  Captures for  http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-public-viewing-in-wien.html\n",
      "5  Captures for  http://www.railtours.at/sonderangebote/oesterreich/wien/eurovision-song-contest-2015-semifinale-1-2.html\n",
      "10  Captures for  http://www.songcontest.at/\n",
      "2  Captures for  http://www.stadthalle.com/de/schauen/events/75/Eurovision-Song-Contest\n",
      "154  Captures for  http://www.vienna.at/specials/eurovision-song-contest\n",
      "5  Captures for  http://www.wien-event.at/events/song-contest/\n",
      "5  Captures for  http://www.wien-ticket.at/de/service/Eurovision-Song-Contest-Wiener-Stadthalle-Wien\n",
      "32  Captures for  http://www.wien.info/de/musik-buehne/eurovision-song-contest\n",
      "6  Captures for  http://www.wienerlinien.at/eportal2/ep/tab.do/pageTypeId/74690\n",
      "100  Captures for  http://www.wienerzeitung.at/dossiers/eurovision_song_contest_2015/\n",
      "32  Captures for  https://instagram.com/esc_buildingbridges/\n",
      "32  Captures for  https://instagram.com/themakemakes/\n",
      "32  Captures for  https://twitter.com/ESC2015ORF\n",
      "32  Captures for  https://twitter.com/Eurovision\n",
      "32  Captures for  https://twitter.com/hashtag/eurovision?src=hash\n",
      "63  Captures for  https://www.facebook.com/ESCBuildingBridges\n",
      "57  Captures for  https://www.facebook.com/EurovisionSongContest\n",
      "112  Captures for  https://www.facebook.com/themakemakes\n",
      "2  Captures for  https://www.stadthalle.com/de/schauen/events/75/Eurovision-Song-Contest\n",
Andreas's avatar
Andreas committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
      "47  Captures for  https://www.wien.gv.at/kultur/esc/\n"
     ]
    }
   ],
   "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",
    "                response = w.wayback_search(seed)\n",
    "                print(response.json()['total'] , ' Captures for ' , seed)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
Andreas's avatar
Andreas committed
178
   "display_name": "Python 3",
Andreas's avatar
Andreas committed
179
   "language": "python",
Andreas's avatar
Andreas committed
180
   "name": "python3"
Andreas's avatar
Andreas committed
181 182 183 184
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
Andreas's avatar
Andreas committed
185
    "version": 3
Andreas's avatar
Andreas committed
186 187 188 189 190
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
Andreas's avatar
Andreas committed
191 192
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
Andreas's avatar
Andreas committed
193 194 195
  }
 },
 "nbformat": 4,
Andreas's avatar
Andreas committed
196
 "nbformat_minor": 1
Andreas's avatar
Andreas committed
197
}