{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Twitter NBA scrape\n", "Notebook to scrape tweets about the NBA.\n", "### Current status: waiting for \"premium\" account to be approved so I can access historical data" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "import praw\n", "import time\n", "import requests\n", "from datetime import datetime\n", "from ast import literal_eval\n", "import json\n", "import pandas as pd\n", "import tweepy" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "credentials = {} \n", "with open(\"twitter_credentials.json\", \"r\") as file: \n", " credentials = json.load(file)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "auth = tweepy.OAuthHandler(credentials['CONSUMER_KEY'], credentials['CONSUMER_SECRET'])\n", "auth.set_access_token(credentials['ACCESS_TOKEN'], credentials['ACCESS_SECRET'])\n", "api = tweepy.API(auth)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "ganma = tweepy.Cursor(api.search, q=\"Kevin Love\",\n", " since = \"2018-05-21\",\n", " until=\"2018-05-22\",\n", " lang=\"en\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.4.5" } }, "nbformat": 4, "nbformat_minor": 2 }