{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'username': '@otwndk',\n",
       " 'time': datetime.datetime(2022, 12, 16, 21, 19, 9, tzinfo=tzutc()),\n",
       " 'content': 'Sponsoreret: Verdensmestre, europamestre og store danske medaljetagere rammer Odense til et prestigefyldt stævne\\n#odense #fyn #cykling'}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from database import Data_table\n",
    "from scraper import scrape\n",
    "\n",
    "topic = 'Odense'\n",
    "username_list, timestamp_list, content_list = scrape(topic, limit=3, headless=False)\n",
    "\n",
    "val_dict = {\n",
    "    'username': username_list[0],\n",
    "    'time': timestamp_list[0],\n",
    "    'content': content_list[0]\n",
    "}\n",
    "\n",
    "print(val_dict)\n",
    "\n",
    "with Data_table() as dt:\n",
    "    dt.insert(val_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       Odense Universitets Hospital søger #Afdelingsc...\n",
       "1       \"Odense Dänemark, Seaside\" Fotografie als Post...\n",
       "2       Danimarka’nın Odense takımı bu yaz müthiş bir ...\n",
       "3       Highlights: SønderjyskE – Odense https://t.co/...\n",
       "4       “Meta Platforms Inc has halted construction of...\n",
       "                              ...                        \n",
       "1810    Kunne du tænke dig at være med til at begejstr...\n",
       "1811    UDEBANEAFSNITTET UDVIDES TIL 1800 PLADSER! \\n\\...\n",
       "1812    Der er lagt op til fynsk fodboldfest på søndag...\n",
       "1813    Jeg har i stigende omfang den oplevelse, at @A...\n",
       "1814    PhD position podning in Odense, Denmark: Impro...\n",
       "Name: content, Length: 1815, dtype: object"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from database import get_content\n",
    "\n",
    "df = get_content()\n",
    "\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('~/Desktop/content.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.6"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "1d532f3642617da00cbdbdc5ef98bd8d4ca226c95ac593ade79d8cbc880a2afe"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
