Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Faster* Instagram Username Checker (Filters Banned Accounts)

After figuring out how to use asyncio and aiohttp I made an Instagram checker that is exponentially faster than the previous one I posted. If you are getting timed out change 'conns=50' to something lower.

Usage (Click to View)

Code (Click to View)
Genuinely smiled at this.

I can't wait for people to get butthurt and flame ITT because they're not cool enough to learn asyncio.
SRPP Discord Server

I am a professional network/cloud security architect.
My Old Tutorials
(Mar 24, 2017 12:46 AM)Goodies Wrote:  Genuinely smiled at this.

I can't wait for people to get butthurt and flame ITT because they're not cool enough to learn asyncio.

Hey, it's harder than it looks 😊😝
Can you do this for c# ? :)
Жизнь это не те дни, что прошли, а те, что запомнились
There's actually a library called aiofiles which is used for asynchronous file I/O. Check it out! 🤝

Usage would be something like:
PHP Code

<?php 
import aiofiles

async def get_usernames
(inputfile):
    
async with aiofiles.open(inputfile, "r") as f:
        
usernames = await f.read()
        return 
usernames.split("\n") 
(Mar 24, 2017 07:44 AM)Dotexe Wrote:  Can you do this for c# ? :)

Any specific reason for this? If you are trying to learn it, I can always try it out but if you are looking for speed and functionality, this isn't going to change that much for such a small program.

Let me know and I can always take a crack at it when I am free!

(Mar 24, 2017 08:29 AM)hunter24957 Wrote:  There's actually a library called aiofiles which is used for asynchronous file I/O. Check it out! 🤝

Usage would be something like:
PHP Code

<?php 
import aiofiles

async def get_usernames
(inputfile):
    
async with aiofiles.open(inputfile, "r") as f:
        
usernames = await f.read()
        return 
usernames.split("\n") 

Although this is useful for some, what would this due for this? I am assuming it would read the file faster?

I'll have to check it out though ✌
(Mar 24, 2017 08:38 AM)Folks Wrote:  Any specific reason for this? If you are trying to learn it, I can always try it out but if you are looking for speed and functionality, this isn't going to change that much for such a small program.

Let me know and I can always take a crack at it when I am free!


Although this is useful for some, what would this due for this? I am assuming it would read the file faster?

I'll have to check it out though ✌

It'll mainly help to make your program more asynchronous, it's great if you're writing to a file while making requests, which I'm assuming your program will do.
(Mar 24, 2017 08:38 AM)Folks Wrote:  Any specific reason for this? If you are trying to learn it, I can always try it out but if you are looking for speed and functionality, this isn't going to change that much for such a small program.

Let me know and I can always take a crack at it when I am free!
The reason is i want to learn how these things works ^_^ i'm not looking for speed and functionality, thanks in advance buddy 🤝
Жизнь это не те дни, что прошли, а те, что запомнились
(Mar 24, 2017 08:42 AM)hunter24957 Wrote:  It'll mainly help to make your program more asynchronous, it's great if you're writing to a file while making requests, which I'm assuming your program will do.

Yea it does, after getting a response it writes to a file if the response contains the right data. Right now I have it just open the file as an appendable file because AFAIK opening a file multiple times isn't bad but writing can be.

(Mar 24, 2017 08:45 AM)Dotexe Wrote:  The reason is i want to learn how these things works ^_^ i'm not looking for speed and functionality, thanks in advance buddy 🤝

Yea sure, I don't know anything abuot C# but I've read it's similar to java which I know a bit about. I'll take a look into it over the weekend!
"Python Enthusiast", waa welcome the py section fam !
(Mar 24, 2017 09:14 AM)SIM-1866423 Wrote:  "Python Enthusiast", waa welcome the py section fam !

Yea, I decided to officialize my nerd status 🤗
Very nice code man, I am trying to learn asyncio as well but one thing I don't understand in your code is why you have the loop set to None in the start_check function?

Keep up the good work

Code
async def start_check(igname, igpass, conns=50, loop=None):
    sem = asyncio.BoundedSemaphore(conns)
    async with aiohttp.ClientSession(loop=loop) as session:
        await login(igname, igpass, session)
        usernames = get_usernames(inputfile)
        tasks = [check_usernames(igname, igpass, username, sem, session, loop=loop) for username in usernames]
        await asyncio.gather(*tasks)
(Mar 24, 2017 12:43 PM)youw0t Wrote:  Very nice code man, I am trying to learn asyncio as well but one thing I don't understand in your code is why you have the loop set to None in the start_check function?

Keep up the good work

Code
async def start_check(igname, igpass, conns=50, loop=None):
    sem = asyncio.BoundedSemaphore(conns)
    async with aiohttp.ClientSession(loop=loop) as session:
        await login(igname, igpass, session)
        usernames = get_usernames(inputfile)
        tasks = [check_usernames(igname, igpass, username, sem, session, loop=loop) for username in usernames]
        await asyncio.gather(*tasks)

What I do is something like this:
PHP Code

<?php 
async def coro
(a, b, *, loop=None):
    
loop = loop or asyncio.get_event_loop() 

This (or similar) is at the beginning of most asyncio functions. If no loop is explicitly provided, it will get the one defined in the current thread (each thread can have one loop defined and, by default, only the main thread has an event loop defined.
SRPP Discord Server

I am a professional network/cloud security architect.
My Old Tutorials
(Mar 24, 2017 12:49 PM)Goodies Wrote:  What I do is something like this:
PHP Code

<?php 
async def coro
(a, b, *, loop=None):
    
loop = loop or asyncio.get_event_loop() 

This (or similar) is at the beginning of most asyncio functions. If no loop is explicitly provided, it will get the one defined in the current thread (each thread can have one loop defined and, by default, only the main thread has an event loop defined.

Ah, that cleared things up. Thanks for the explanation
Does this also work to see if an email is in use or is not in use? Thanks in advance.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by -Nerotic-Oct 20, 2020 11:36 AM 14 441 Oct 20, 2020 11:36 AM
Last Post: CodeAssassin
[Python] by -Nerotic-Jul 13, 2020 10:53 AM 3 278 Jul 13, 2020 10:53 AM
Last Post: SIM-3587630
[Python] by -Nerotic-Jul 11, 2020 04:08 PM 7 168 Jul 11, 2020 04:08 PM
Last Post: Pawnhub