From 13c44c71b37877944521d5824a507c0c42e6a4f9 Mon Sep 17 00:00:00 2001 From: darroyolpz Date: Sat, 7 Sep 2019 18:32:34 +0200 Subject: Twitter functionality available --- Data Scraping for Binance Announcements.ipynb | 63 ++++++++++----------------- 1 file changed, 22 insertions(+), 41 deletions(-) (limited to 'Data Scraping for Binance Announcements.ipynb') diff --git a/Data Scraping for Binance Announcements.ipynb b/Data Scraping for Binance Announcements.ipynb index d45aaa1..d7093b0 100644 --- a/Data Scraping for Binance Announcements.ipynb +++ b/Data Scraping for Binance Announcements.ipynb @@ -17,13 +17,13 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import bs4 as bs\n", "import urllib.request\n", - "import tweepy, os" + "import tweepy, os, time" ] }, { @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -59,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -75,7 +75,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -91,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -120,15 +120,15 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 38.2 ms, sys: 3.74 ms, total: 41.9 ms\n", - "Wall time: 147 ms\n" + "CPU times: user 30.9 ms, sys: 349 µs, total: 31.2 ms\n", + "Wall time: 77.1 ms\n" ] } ], @@ -139,54 +139,35 @@ ] }, { - "cell_type": "code", - "execution_count": 6, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[['Binance Lists Chiliz (CHZ)',\n", - " 'https://www.binance.com/en/support/articles/360033377831'],\n", - " ['Binance Completes Perlin Lottery Draw and Will Open Trading For PERL',\n", - " 'https://www.binance.com/en/support/articles/360032900851'],\n", - " ['Binance Lists Second BEP2 Community Listing Project - TomoChain (TOMO)',\n", - " 'https://www.binance.com/en/support/articles/360032514812'],\n", - " ['Introducing the Band Protocol (BAND) Token Sale on Binance Launchpad',\n", - " 'https://www.binance.com/en/support/articles/360033102832'],\n", - " ['Pepito', 'Fulanito']]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "new_urls = extract_binance(main_webpage, key_words)\n", - "a = ['Pepito', 'Fulanito']\n", - "new_urls.append(a)" + "Loop pass and get the new announcements" ] }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Pepito\n" + "Done for now. Time to go to sleep mate!\n" ] } ], "source": [ - "for item in new_urls:\n", - " if item not in old_urls:\n", - " msg = item[0]\n", - " print(msg)\n", - " #api.update_status('Testing')" + "# Loop pass - Watchdog mode\n", + "while True:\n", + " new_urls = extract_binance(main_webpage, key_words)\n", + " for item in new_urls:\n", + " if item not in old_urls:\n", + " msg = item[0] + '\\n' + item[1]\n", + " api.update_status(msg)\n", + " print('Done for now. Time to go to sleep mate!')\n", + " time.sleep(900) # Check every 15 min" ] } ], -- cgit v1.2.3