Skip to content

Commit

Permalink
added fans and notfollowing
Browse files Browse the repository at this point in the history
Added /fans command.
Added /notfollowing command.
  • Loading branch information
subinps committed Jun 20, 2021
1 parent b2fc265 commit 441d2ac
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

*.pyc
*.session
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ You can Download almost anything From your Instagram Account.

**What Can Be Downloaded?:**
```
1. All posts of any Profile. (Both Public and Private profiles which you follows.)
1. All posts of any Profile. (Both Public and Private,for private profiles you need to be a follower.)
2. All Posts from your feed.
3. Stories of any profile (Both Public and Private profiles which you follows.)
3. Stories of any profile (Both Public and Private,for private profiles you need to be a follower.)
4. DP of any profile (No need to follow)
5. Followers and Followees List of any Profile.
6. Stories of your Followees.
7. Tagged posts of any profile.
8. Your saved Posts.
9. IGTV videos.
10. Highlights from any profiles.
11. Any Public Post from Link(Post/Reels/IGTV)
6. List of followees who follows back the given username.
7. List of followees who are not following back the given username.
8. Stories of your Followees.
9. Tagged posts of any profile.
10. Your saved Posts.
11. IGTV videos.
12. Highlights from any profiles.
13. Any Public Post from Link(Post/Reels/IGTV)
```

Expand Down Expand Up @@ -53,6 +55,10 @@ Example: /followers samantharuthprabhuoffl
/followees <username> - Get a list of all followees of given username. If no username given, then your list will be retrieved.
/fans <username> - Get a list of of followees who follow back the given username. If no username given, your list will be retrieved.
/notfollowing <username> - Get a list of followees who is not following back the given username.
/tagged <username> - Downloads all posts in which given username is tagged. If nothing given your tagged posts will be downloaded.
/story <username> - Downloads all stories from given username. If nothing given your stories will be downloaded.
Expand Down
18 changes: 12 additions & 6 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ class Config:
3. Stories of any profile (Both Public and Private,for private profiles you need to be a follower.)
4. DP of any profile (No need to follow)
5. Followers and Followees List of any Profile.
6. Stories of your Followees.
7. Tagged posts of any profile.
8. Your saved Posts.
9. IGTV videos.
10. Highlights from any profiles.
11. Any Public Post from Link(Post/Reels/IGTV)
6. List of followees who follows back the given username.
7. List of followees who are not following back the given username.
8. Stories of your Followees.
9. Tagged posts of any profile.
10. Your saved Posts.
11. IGTV videos.
12. Highlights from any profiles.
13. Any Public Post from Link(Post/Reels/IGTV)
<b>How to Download:</b>
Expand Down Expand Up @@ -78,6 +80,10 @@ class Config:
/followees <username> - Get a list of all followees of given username. If no username given, then your list will be retrieved.
/fans <username> - Get a list of of followees who follow back the given username. If no username given, your list will be retrieved.
/notfollowing <username> - Get a list of followees who is not following back the given username.
/tagged <username> - Downloads all posts in which given username is tagged. If nothing given your tagged posts will be downloaded.
/story <username> - Downloads all stories from given username. If nothing given your stories will be downloaded.
Expand Down
8 changes: 8 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ async def main():
command="followees",
description="Sends a list followees of given username"
),
types.BotCommand(
command="fans",
description="Get a list of followees who is following back."
),
types.BotCommand(
command="notfollowing",
description="Get a list of followees who is not following back."
),
types.BotCommand(
command="tagged",
description="Download all posts tagged with given username"
Expand Down
118 changes: 118 additions & 0 deletions plugins/insta_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,124 @@ async def followees(bot, message):
os.remove(f"./{username}'s followees.txt")




@Client.on_message(filters.command("fans") & filters.private)
async def fans(bot, message):
if str(message.from_user.id) != OWNER:
await message.reply_text(
HOME_TEXT.format(message.from_user.first_name, message.from_user.id, USER, USER, USER, OWNER),
reply_markup=buttons,
disable_web_page_preview=True
)
return
text=message.text
username=USER
if 1 not in STATUS:
await message.reply_text("You Must Login First /login ")
return
if " " in text:
cmd, username = text.split(' ')
profile = Profile.from_username(insta.context, username)
is_followed = yes_or_no(profile.followed_by_viewer)
type = acc_type(profile.is_private)
if type == "🔒Private🔒" and is_followed == "No":
await message.reply_text("Sorry!\nI can't fetch details from that account.\nSince its a Private account and you are not following <code>@{username}</code>.")
return
profile = Profile.from_username(insta.context, username)
name=profile.full_name
m=await message.reply_text(f"Fetching list of followees of <code>@{username}</code> who follows <code>@{username}</code>.")
chat_id=message.from_user.id
f = profile.get_followers()
fl = profile.get_followees()
flist=[]
fmlist=[]
for fn in f:
u=fn.username
flist.append(u)
for fm in fl:
n=fm.username
fmlist.append(n)

fans = [value for value in fmlist if value in flist]
print(len(fans))
followers=f"**Fans List for {name}**\n\n"
for p in fans:
followers += f"\n[{p}](www.instagram.com/{p})"
try:
await m.delete()
await bot.send_message(chat_id=chat_id, text=followers)
except MessageTooLong:
followers=f"**Fans List for {name}**\n\n"

for p in fans:
followers += f"\nName: {p} : Link to Profile: www.instagram.com/{p}"
text_file = open(f"{username}'s fans.txt", "w")
text_file.write(followers)
text_file.close()
await bot.send_document(chat_id=chat_id, document=f"./{username}'s fans.txt", caption=f"{name}'s fans\n\nA Project By [XTZ_Bots](https://t.me/subin_works)")
os.remove(f"./{username}'s fans.txt")


@Client.on_message(filters.command("notfollowing") & filters.private)
async def nfans(bot, message):
if str(message.from_user.id) != OWNER:
await message.reply_text(
HOME_TEXT.format(message.from_user.first_name, message.from_user.id, USER, USER, USER, OWNER),
reply_markup=buttons,
disable_web_page_preview=True
)
return
text=message.text
username=USER
if 1 not in STATUS:
await message.reply_text("You Must Login First /login ")
return
if " " in text:
cmd, username = text.split(' ')
profile = Profile.from_username(insta.context, username)
is_followed = yes_or_no(profile.followed_by_viewer)
type = acc_type(profile.is_private)
if type == "🔒Private🔒" and is_followed == "No":
await message.reply_text("Sorry!\nI can't fetch details from that account.\nSince its a Private account and you are not following <code>@{username}</code>.")
return
profile = Profile.from_username(insta.context, username)
name=profile.full_name
m=await message.reply_text(f"Fetching list of followees of <code>@{username}</code> who is <b>not</b> following <code>@{username}</code>.")
chat_id=message.from_user.id
f = profile.get_followers()
fl = profile.get_followees()
flist=[]
fmlist=[]
for fn in f:
u=fn.username
flist.append(u)
for fm in fl:
n=fm.username
fmlist.append(n)

fans = list(set(fmlist) - set(flist))
print(len(fans))
followers=f"**Followees of <code>@{username}</code> who is <b>not</b> following <code>@{username}</code>**\n\n"
for p in fans:
followers += f"\n[{p}](www.instagram.com/{p})"
try:
await m.delete()
await bot.send_message(chat_id=chat_id, text=followers)
except MessageTooLong:
followers=f"Followees of <code>@{username}</code> who is <b>not</b> following <code>@{username}</code>\n\n"
for p in fans:
followers += f"\nName: {p} : Link to Profile: www.instagram.com/{p}"
text_file = open(f"{username}'s Non_followers.txt", "w")
text_file.write(followers)
text_file.close()
await bot.send_document(chat_id=chat_id, document=f"./{username}'s Non_followers.txt", caption=f"{name}'s Non_followers\n\nA Project By [XTZ_Bots](https://t.me/subin_works)")
os.remove(f"./{username}'s Non_followers.txt")





@Client.on_message(filters.command("feed") & filters.private)
async def feed(bot, message):
if str(message.from_user.id) != OWNER:
Expand Down
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async def upload(m, bot, chat_id, dir):
except FloodWait as e:
await asyncio.sleep(e.x)
await bot.send_media_group(chat_id=chat_id, media=media, disable_notification=True)
await m.edit(f"Total: {total}\nUploaded: {up} Remaining to upload: {rm}")
await m.edit(f"Total: {total}\nUploaded: {up} Remaining to upload: {rm}")

if totalvideo >= 2:
for i in range(0, len(VDO), 10):
Expand All @@ -172,7 +172,7 @@ async def upload(m, bot, chat_id, dir):
except FloodWait as e:
await asyncio.sleep(e.x)
await bot.send_media_group(chat_id=chat_id, media=media, disable_notification=True)
await m.edit(f"Total: {total}\nUploaded: {up} Remaining to upload: {rm}")
await m.edit(f"Total: {total}\nUploaded: {up} Remaining to upload: {rm}")
if totalgif >= 2:
for gif in GIF:
try:
Expand Down

0 comments on commit 441d2ac

Please sign in to comment.