"include/svn:/svn.code.sf.net/p/irrlicht/code/trunk@2782" did not exist on "82fc088f15cb08d869193328a18152629195e33a"
Commit fd2411ef authored by Cody Zacharias's avatar Cody Zacharias Committed by GitHub

Update followers.py

parent 770a69f2
from . import feed, get, db, output, elasticsearch
from bs4 import BeautifulSoup
import aiohttp
import asyncio
import re
import sys
......@@ -12,8 +11,11 @@ class Followers:
self.count = 0
self.config = config
if self.config.Elasticsearch:
print("[+] Indexing to Elasticsearch @ " + str(self.config.Elasticsearch))
if self.config.Database:
print("Inserting into Database: " + str(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)
......@@ -23,16 +25,14 @@ class Followers:
loop.run_until_complete(self.main())
async def Feed(self):
ua = {'User-Agent': 'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/0.8.12'}
connect = aiohttp.TCPConnector(verify_ssl=False)
async with aiohttp.ClientSession(headers=ua, connector=connect) as session:
response = await get.Response(session, await get.Url(self.config,
self.init).followers())
url = await get.Url(self.config, self.init).followers()
response = await get.MobileRequest(self.config, url)
self.feed = []
try:
self.feed, self.init = feed.Follow(response)
except:
pass
return self.feed
async def follower(self):
......@@ -46,14 +46,16 @@ class Followers:
output.write(User.name, self.config.Output)
if self.config.Elasticsearch:
elasticsearch.Follow(self.config.Elasticsearch, User.name, self.config.Username, self.config.Essid)
elasticsearch.Follow(self.config.Elasticsearch, User.name,
self.config.Username, self.config.Essid)
self.count += 1
print(User.name)
async def main(self):
if self.config.User_id is not None:
self.config.Username = await get.Username(self.config.User_id)
self.config.Username = await get.Username(self.config)
while True:
if len(self.feed) > 0:
await self.follower()
......
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