🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    src/telepathy/telepathy.py
    skipped 101 lines
    102 102   comprehensive,
    103 103   media,
    104 104   json,
    105  - translate
     105 + translate,
    106 106   ):
    107 107   self.client = client
    108 108   self._target = target
    skipped 83 lines
    192 192   pass
    193 193   return current_entity
    194 194   
    195  - async def looking_for_members(self,_target):
     195 + async def looking_for_members(self, _target):
    196 196   members = []
    197 197   members_df = None
    198 198   all_participants = await self.client.get_participants(_target, limit=5000)
    skipped 259 lines
    458 458   
    459 459   if self.comp_check:
    460 460   self.file_archive = create_file_report(
    461  - self.save_directory, self._alphanumeric, "archive", "csv", self._filetime
     461 + self.save_directory,
     462 + self._alphanumeric,
     463 + "archive",
     464 + "csv",
     465 + self._filetime,
    462 466   )
    463 467   self.reply_file_archive = create_file_report(
    464 468   self.save_directory,
    skipped 17 lines
    482 486   os.path.join(self.save_directory, "edgelist")
    483 487   )
    484 488   self.file_forwards = create_file_report(
    485  - self.forward_directory, self._alphanumeric, "edgelist", "csv", self._filetime
     489 + self.forward_directory,
     490 + self._alphanumeric,
     491 + "edgelist",
     492 + "csv",
     493 + self._filetime,
    486 494   )
    487 495   self.edgelist_file = create_file_report(
    488 496   self.forward_directory,
    skipped 181 lines
    670 678   except AttributeError:
    671 679   pass
    672 680   
    673  - async def retrieve_self_history(self,_target=None):
    674  - cc=False
     681 + async def retrieve_self_history(self, _target=None):
     682 + cc = False
    675 683   if not _target:
    676 684   _target = self._target
    677  - cc=True
     685 + cc = True
    678 686   _target = clean_private_invite(_target)
    679 687   await self.retrieve_chat_group_entity(_target)
    680 688   
    skipped 5 lines
    686 694   limit=1,
    687 695   max_id=0,
    688 696   min_id=0,
    689  - hash=0
     697 + hash=0,
    690 698   )
    691 699   history = await self.client(get_history)
    692 700   if isinstance(history, Messages):
    skipped 7 lines
    700 708   return None, None
    701 709   else:
    702 710   return history, count
    703  - 
    704 711   
    705 712   async def process_group_channel_messages(self, _target):
    706 713   if self.forwards_check is True and self.comp_check is False:
    skipped 164 lines
    871 878   forwards_list = []
    872 879   replies_list = []
    873 880   user_replier_list = []
    874  - forward_count, private_count, message_count = 0, 0, 0
     881 + forward_count, private_count, message_count, total_reactions = (
     882 + 0,
     883 + 0,
     884 + 0,
     885 + 0,
     886 + )
    875 887   
    876 888   if self.media_archive is True:
    877 889   print("\n")
    skipped 215 lines
    1093 1105   else:
    1094 1106   views = "N/A"
    1095 1107   
    1096  - if message.reactions:
    1097  - (
    1098  - total_reactions,
    1099  - reaction_detail,
    1100  - ) = evaluate_reactions(message)
     1108 + total_reactions, reaction_detail = evaluate_reactions(
     1109 + message
     1110 + )
    1101 1111   
    1102 1112   if self.media_archive:
    1103 1113   if message.media is not None:
    skipped 435 lines
    1539 1549   target_type = None
    1540 1550   export = False
    1541 1551   
    1542  - 
    1543 1552   def __init__(
    1544 1553   self,
    1545 1554   target,
    skipped 62 lines
    1608 1617   self.telepathy_file, self.config_p["telepathy"]["export_file"]
    1609 1618   )
    1610 1619   else:
    1611  - self.telepathy_file = os.path.join("..","src","telepathy","telepathy_files")
    1612  - self.json_file = os.path.join(self.telepathy_file,"json_files")
    1613  - self.login = os.path.join(self.telepathy_file,"login.txt")
    1614  - self.log_file = os.path.join(self.telepathy_file,"log.csv")
    1615  - self.export_file = os.path.join(self.telepathy_file,"export.csv")
     1620 + self.telepathy_file = os.path.join(
     1621 + "..", "src", "telepathy", "telepathy_files"
     1622 + )
     1623 + self.json_file = os.path.join(self.telepathy_file, "json_files")
     1624 + self.login = os.path.join(self.telepathy_file, "login.txt")
     1625 + self.log_file = os.path.join(self.telepathy_file, "log.csv")
     1626 + self.export_file = os.path.join(self.telepathy_file, "export.csv")
    1616 1627   self.create_path(self.telepathy_file)
    1617  - self.overlaps_dir = os.path.join(self.telepathy_file,"overlaps")
     1628 + self.overlaps_dir = os.path.join(self.telepathy_file, "overlaps")
    1618 1629   self.bots_dir = os.path.join(self.telepathy_file, "bots")
    1619 1630   self.create_path(self.overlaps_dir)
    1620 1631   self.target = target
    1621 1632   self.create_tg_client()
    1622 1633   
    1623  - 
    1624 1634   @staticmethod
    1625 1635   def create_path(path_d):
    1626 1636   if not os.path.exists(path_d):
    skipped 37 lines
    1664 1674   else:
    1665 1675   self.api_id, self.api_hash, self.phone_number = self.retrieve_alt()
    1666 1676   """End of API details"""
    1667  - self.client = TelegramClient(os.path.join(self.telepathy_file,"{}.session".format(self.phone_number)), self.api_id, self.api_hash)
     1677 + self.client = TelegramClient(
     1678 + os.path.join(self.telepathy_file, "{}.session".format(self.phone_number)),
     1679 + self.api_id,
     1680 + self.api_hash,
     1681 + )
    1668 1682   
    1669 1683   async def connect_tg_client_and_run(self):
    1670 1684   await self.client.connect()
    skipped 172 lines
    1843 1857   bot_me = bot_info.get_me()
    1844 1858   user = await bot_info(GetFullUserRequest(bot_me))
    1845 1859   user_info = user.user.to_dict()
    1846  - user_info['token'] = self.bot
     1860 + user_info["token"] = self.bot
    1847 1861   
    1848 1862   bot_obj = createPlaceholdeCls()
    1849 1863   bot_obj.id = bot_me.id
    skipped 4 lines
    1854 1868   bot_obj.user_first_name = bot_me.user_first_name
    1855 1869   
    1856 1870   ###TODO FIX TYPE, TEST, SAVEFILE EXPLORE/DUMP CHAT HISTORY
    1857  - print_shell("bot",bot_obj )
     1871 + print_shell("bot", bot_obj)
    1858 1872   
    1859 1873   @staticmethod
    1860 1874   def reiterate_overlaps(dp, dp2, join):
    1861  - return pd.merge(dp,dp2,on=join)
     1875 + return pd.merge(dp, dp2, on=join)
     1876 + 
    1862 1877   async def telepangulate(self):
    1863 1878   current_set = None
    1864 1879   filename = "overlaps_"
    1865  - if len(self.target)>1:
     1880 + if len(self.target) > 1:
    1866 1881   group_processor = Group_Chat_Analisys(
    1867  - self.target[0],
    1868  - self.client,
    1869  - self.log_file,
    1870  - self.filetime,
    1871  - self.reply_analysis,
    1872  - self.forwards_check,
    1873  - self.comp_check,
    1874  - self.media_archive,
    1875  - self.json_check,
    1876  - self.translate_check,
    1877  - )
    1878  - pd_members, = group_processor.looking_for_members()
    1879  - filename = filename+"_"+self.target[0]
     1882 + self.target[0],
     1883 + self.client,
     1884 + self.log_file,
     1885 + self.filetime,
     1886 + self.reply_analysis,
     1887 + self.forwards_check,
     1888 + self.comp_check,
     1889 + self.media_archive,
     1890 + self.json_check,
     1891 + self.translate_check,
     1892 + )
     1893 + (pd_members,) = group_processor.looking_for_members()
     1894 + filename = filename + "_" + self.target[0]
    1880 1895   for _t, i in self.target:
    1881  - filename = filename +"_"+ _t
     1896 + filename = filename + "_" + _t
    1882 1897   dp_t = group_processor.looking_for_members(_t)
    1883 1898   if i == 1:
    1884  - current_set = pd.merge(pd_members,dp_t, how="inner", on=["User ID"])
     1899 + current_set = pd.merge(
     1900 + pd_members, dp_t, how="inner", on=["User ID"]
     1901 + )
    1885 1902   elif i > 1:
    1886  - current_set = pd.merge(current_set,dp_t, how="inner", on=["User ID"])
    1887  - if(current_set):
     1903 + current_set = pd.merge(
     1904 + current_set, dp_t, how="inner", on=["User ID"]
     1905 + )
     1906 + if current_set:
    1888 1907   filename = filename + ".csv"
    1889 1908   current_set.to_csv(os.path.join(self.overlaps_dir, filename), sep=";")
    1890 1909   
    skipped 165 lines
  • ■ ■ ■ ■ ■ ■
    src/telepathy/utils.py
    skipped 145 lines
    146 146   except:
    147 147   name = "Not found"
    148 148   try:
    149  - group_description = soup.find("div", {"class": ["tgme_page_description"]}).text
    150  - descript = Fore.GREEN + "Description: " + Style.RESET_ALL + group_description
     149 + group_description = (
     150 + soup.find("div", {"class": ["tgme_page_description"]})
     151 + .getText(separator="\n")
     152 + .replace("\n", " ")
     153 + )
     154 + # descript = Fore.GREEN + "Description: " + Style.RESET_ALL + group_description
    151 155   except:
    152 156   group_description = "None"
    153  - descript = Fore.GREEN + "Description: " + Style.RESET_ALL + group_description
    154  - 
     157 + # descript = Fore.GREEN + "Description: " + Style.RESET_ALL + group_description
    155 158   try:
    156 159   group_participants = soup.find("div", {"class": ["tgme_page_extra"]}).text
    157 160   sep = "members"
    skipped 177 lines
    335 338   return url.replace("https://t.me/+", "https://t.me/joinchat/")
    336 339   return url
    337 340   
    338  -def evaluate_reactions(message):
     341 + 
     342 +def evaluate_reactions(message, create=False):
    339 343   total_reactions = 0
    340 344   reactions = {}
    341  - if message.reactions:
     345 + if not create and message.reactions:
    342 346   reactions_l = message.reactions.results
    343 347   for idx, i in enumerate(reactions_l):
    344 348   total_reactions = total_reactions + i.count
    skipped 38 lines
Please wait...
Page is in error, reload to recover