Commit 2fe92365 authored by Cody Zacharias's avatar Cody Zacharias Committed by GitHub

1.1.3 Update

parent b57b1099
from . import db, get, feed, output from . import db, get, feed, output, verbose
import asyncio
import re
import sys
class Profile: class Profile:
def __init__(self, config): def __init__(self, config):
...@@ -9,50 +6,41 @@ class Profile: ...@@ -9,50 +6,41 @@ class Profile:
self.feed = [-1] self.feed = [-1]
self.count = 0 self.count = 0
self.config = config self.config = config
self.conn = db.Conn(config.Database)
self.config.Profile = True self.config.Profile = True
if self.config.Elasticsearch: verbose.Elastic(config)
print("[+] Indexing to Elasticsearch @ " + str(self.config.Elasticsearch))
if self.config.Database:
print("[+] Inserting into Database: " + str(self.config.Database))
self.conn = db.init(self.config.Database)
if isinstance(self.conn, str):
print(str)
else:
self.conn = ""
loop = asyncio.get_event_loop()
loop.run_until_complete(self.main())
async def Feed(self): async def Feed(self):
url = await get.Url(self.config, self.init).profile() response = await get.RequestUrl(self.config, self.init)
response = await get.Request(self.config, url)
self.feed = [] self.feed = []
try: try:
self.feed, self.init = feed.profile(response) if self.config.Profile_full:
self.feed, self.init = feed.Mobile(response)
else:
self.feed, self.init = feed.profile(response)
except: except:
pass pass
async def tweets(self): async def tweets(self):
await self.Feed() await self.Feed()
for tweet in self.feed: if self.config.Profile_full:
self.count += 1 self.count += await get.Multi(self.feed, self.config, self.conn)
await output.Tweets(tweet, "", self.config, self.conn) else:
for tweet in self.feed:
self.count += 1
await output.Tweets(tweet, "", self.config, self.conn)
async def main(self): async def main(self):
if self.config.User_id is not None: if self.config.User_id is not None:
self.config.Username = await get.Username(self.config) self.config.Username = await get.Username(self.config.User_id)
while True: while True:
if len(self.feed) > 0: if len(self.feed) > 0:
await self.tweets() await self.tweets()
else: elif get.Limit(self.config.Limit, self.count):
break break
else:
if self.config.Limit is not None and self.count >= int(self.config.Limit):
break break
if self.config.Count: verbose.Count(self.config, self.count)
print("[+] Finished: Successfully collected {0.count} Tweets from @{0.config.Username}.".format(self))
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