Commit 8bb3ac6b authored by Cody Zacharias's avatar Cody Zacharias Committed by GitHub

Cleanup & Moving stuff around

parent 6f1f5629
#!/usr/bin/python3
from bs4 import BeautifulSoup
from elasticsearch import Elasticsearch
from time import gmtime, strftime
import argparse
import aiohttp
......@@ -7,12 +8,10 @@ import asyncio
import async_timeout
import csv
import datetime
import hashlib
import json
import re
import sys
import hashlib
from elasticsearch import Elasticsearch
async def getUrl(init):
'''
......@@ -151,6 +150,15 @@ async def outTweet(tweet):
except:
pass
# Preparing to output
'''
There were certain cases where I used Tweep
to gather a list of users and then fed that
generated list into Tweep. That's why these
modes exist.
'''
if arg.elasticsearch:
jObject = {
"tweetid": tweetid,
"datestamp": date + " " + time,
......@@ -163,21 +171,10 @@ async def outTweet(tweet):
"username": username
}
# Preparing to output
'''
There were certain cases where I used Tweep
to gather a list of users and then fed that
generated list into Tweep. That's why these
modes exist.
'''
if arg.elasticsearch:
es = Elasticsearch(arg.elasticsearch)
es.index(index="tweep", doc_type="items", id=tweetid, body=json.dumps(jObject))
return ""
else:
if arg.users:
output = ""
elif arg.users:
output = username
elif arg.tweets:
output = tweets
......@@ -249,6 +246,10 @@ async def main():
'''
Putting it all together.
'''
if arg.elasticsearch:
print("Indexing to Elasticsearch @" + str(arg.elasticsearch))
if arg.userid is not None:
arg.u = await getUsername()
......@@ -313,8 +314,6 @@ if __name__ == "__main__":
arg = ap.parse_args()
check()
if arg.elasticsearch:
print("Indexing to Elasticsearch @" + str(arg.elasticsearch))
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment