🤬
  • ■ ■ ■ ■ ■
    src/telepathy/telepathy.py
    skipped 191 lines
    192 192   pass
    193 193   return current_entity
    194 194   
    195  - async def retrieve_memberlist(self):
     195 + async def looking_for_members(self,_target):
    196 196   members = []
    197 197   members_df = None
    198  - all_participants = await self.client.get_participants(self._target, limit=5000)
     198 + all_participants = await self.client.get_participants(_target, limit=5000)
    199 199   
    200 200   for user in all_participants:
    201 201   members_df = pd.DataFrame(
    skipped 6 lines
    208 208   "Group name",
    209 209   ],
    210 210   )
    211  - members.append(populate_user(user, self._target))
     211 + members.append(populate_user(user, _target))
     212 + return members_df, all_participants
    212 213   
     214 + async def retrieve_memberlist(self):
     215 + members_df, all_participants = await self.looking_for_members(self._target)
    213 216   if members_df is not None:
    214 217   with open(self.memberlist_filename, "w+", encoding="utf-8") as save_members:
    215 218   members_df.to_csv(save_members, sep=";")
    skipped 451 lines
    667 670   except AttributeError:
    668 671   pass
    669 672   
    670  - async def retrieve_self_history(self,_target):
     673 + async def retrieve_self_history(self,_target=None):
     674 + cc=False
    671 675   if not _target:
    672 676   _target = self._target
     677 + cc=True
    673 678   _target = clean_private_invite(_target)
    674 679   await self.retrieve_chat_group_entity(_target)
    675 680   
    skipped 13 lines
    689 694   else:
    690 695   count = history.count
    691 696   
    692  - self.history = history
    693  - self.history_count = count
     697 + if cc:
     698 + self.history = history
     699 + self.history_count = count
     700 + return None, None
     701 + else:
     702 + return history, count
     703 + 
    694 704   
    695 705   async def process_group_channel_messages(self, _target):
    696 706   if self.forwards_check is True and self.comp_check is False:
    skipped 16 lines
    713 723   ],
    714 724   )
    715 725   
    716  - async for message in self.client.iter_messages(_target):
     726 + await self.retrieve_self_history()
     727 + for message in self.history.messages:
    717 728   if message.forward is not None:
    718 729   forward_count += 1
    719 730   
    skipped 135 lines
    855 866   else:
    856 867   if self.comp_check is True:
    857 868   
    858  - messages = self.client.iter_messages(_target)
    859 869   files = []
    860 870   message_list = []
    861 871   forwards_list = []
    skipped 7 lines
    869 879   
    870 880   color_print_green(" [!] ", "Calculating number of messages...")
    871 881   
    872  - async for message in messages:
    873  - if message is not None:
    874  - message_count += 1
    875  - 
     882 + await self.retrieve_self_history()
    876 883   print("\n")
    877 884   color_print_green(" [-] ", "Fetching message archive...")
    878 885   progress_bar = Fore.GREEN + " [-] " + Style.RESET_ALL + "Progress: "
    879 886   
    880 887   with alive_bar(
    881  - message_count,
     888 + self.history_count,
    882 889   dual_line=True,
    883 890   title=progress_bar,
    884 891   length=20,
    skipped 723 lines
    1608 1615   self.export_file = os.path.join(self.telepathy_file,"export.csv")
    1609 1616   
    1610 1617   self.create_path(self.telepathy_file)
     1618 + self.overlaps_dir = os.path.join(self.telepathy_file,"overlaps")
     1619 + self.create_path(self.overlaps_dir)
    1611 1620   self.target = target
    1612 1621   self.create_tg_client()
    1613 1622   
    skipped 207 lines
    1821 1830   " [!] ",
    1822 1831   "The bot_id/bot_hash isn't valid. Pls insert a valid api_id//api_hash",
    1823 1832   )
     1833 + 
     1834 + @staticmethod
     1835 + def reiterate_overlaps(dp, dp2, join):
     1836 + return pd.merge(dp,dp2,on=join)
     1837 + async def telepangulate(self):
     1838 + current_set = None
     1839 + filename = "overlaps_"
     1840 + if len(self.target)>1:
     1841 + group_processor = Group_Chat_Analisys(
     1842 + self.target[0],
     1843 + self.client,
     1844 + self.log_file,
     1845 + self.filetime,
     1846 + self.reply_analysis,
     1847 + self.forwards_check,
     1848 + self.comp_check,
     1849 + self.media_archive,
     1850 + self.json_check,
     1851 + self.translate_check,
     1852 + )
     1853 + pd_members, = group_processor.looking_for_members()
     1854 + filename = filename+"_"+self.target[0]
     1855 + for _t, i in self.target:
     1856 + filename = filename +"_"+ _t
     1857 + dp_t = group_processor.looking_for_members(_t)
     1858 + if i == 1:
     1859 + current_set = pd.merge(pd_members,dp_t, how="inner", on=["User ID"])
     1860 + elif i > 1:
     1861 + current_set = pd.merge(current_set,dp_t, how="inner", on=["User ID"])
     1862 + if(current_set):
     1863 + filename = filename + ".csv"
     1864 + current_set.to_csv(os.path.join(self.overlaps_dir, filename), sep=";")
    1824 1865   
    1825 1866   async def analyze_user(self, _target):
    1826 1867   my_user = None
    skipped 163 lines
  • ■ ■ ■ ■ ■
    src/telepathy/utils.py
    skipped 326 lines
    327 327   total_reactions = 0
    328 328   reactions = {}
    329 329   if message.reactions:
    330  - reactions = message.reactions.results
    331  - i = range(len(reactions))
    332  - for idx, i in enumerate(reactions):
     330 + reactions_l = message.reactions.results
     331 + for idx, i in enumerate(reactions_l):
    333 332   total_reactions = total_reactions + i.count
    334 333   reactions["thumbs_up"] = i.count if i.reaction == "👍" else 0
    335 334   reactions["thumbs_down"] = i.count if i.reaction == "👎" else 0
    skipped 36 lines
Please wait...
Page is in error, reload to recover