amiryousefi / telegram-analysis Goto Github PK
View Code? Open in Web Editor NEWTelegram Analysis Tools
Telegram Analysis Tools
Traceback (most recent call last):
File "api.py", line 28, in
config.read("config.ini")
File "/usr/lib/python3.8/configparser.py", line 697, in read
self._read(fp, filename)
File "/usr/lib/python3.8/configparser.py", line 1082, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'config.ini', line: 4
line 960, in getitem
raise KeyError(key)
KeyError: 'Telegram'
is there any way to scrape comments from channel?
I Want To Know The Names Of Persons Who Shared A Particular Message Of My Telegram Channel To Other People Because Telegram Only Show How Much Time A Particular Message Is Shared Please Tell Me How Can I Achieve The Above Thing
All the properties were updated on config.ini and properly parsed. Checked with print command.
All the values configured inside config.ini gotten using this page https://core.telegram.org/api/obtaining_api_id from your article on medium
runfile('C:/Users/dfcas/Documents/Python/Projects/lib/ChannelMessages.py', wdir='C:/Users/dfcas/Documents/Python/Projects/lib')
Traceback (most recent call last):
File "C:\Users\dfcas\Documents\Python\Projects\lib\ChannelMessages.py", line 95, in
with client:
File "C:\ProgramData\Anaconda3\lib\site-packages\telethon\helpers.py", line 166, in _sync_enter
raise RuntimeError(
RuntimeError: You must use "async with" if the event loop is running (i.e. you are inside an "async def")
ImportError: cannot import name 'functions' from 'telethon.tl' (C:\ProgramData\Telethon-daf\Telethon-daf21f12d9c183351fef8e10373a13aa6f51f191\telethon\tl_init_.py)
=||||||||||||||||||||||||||||||
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 7.8.0 -- An enhanced Interactive Python.
runfile('C:/Users/Devendra Chandora/Downloads/telegram-analysis-master/telegram-analysis-master/ChannelMessages.py', wdir='C:/Users/Devendra Chandora/Downloads/telegram-analysis-master/telegram-analysis-master')
Traceback (most recent call last):
File "", line 1, in
runfile('C:/Users/Devendra Chandora/Downloads/telegram-analysis-master/telegram-analysis-master/ChannelMessages.py', wdir='C:/Users/Devendra Chandora/Downloads/telegram-analysis-master/telegram-analysis-master')
File "C:\Users\Devendra Chandora\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\Devendra Chandora\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Devendra Chandora/Downloads/telegram-analysis-master/telegram-analysis-master/ChannelMessages.py", line 95, in
with client:
File "C:\Users\Devendra Chandora\Anaconda3\lib\site-packages\telethon\helpers.py", line 151, in _sync_enter
'You must use "async with" if the event loop '
RuntimeError: You must use "async with" if the event loop is running (i.e. you are inside an "async def")
Hi, How I can fix this issue ive used both python and Python3 (.6 .9) thanks
MACOSX high sierra python and dep update
(base) sofiane-MacBook-Pro:telegram-analysis Apple$ python3.6 ChannelUsers.py
Traceback (most recent call last):
File "ChannelUsers.py", line 18, in
api_id = config['Telegram']['api_id']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 959, in getitem
raise KeyError(key)
KeyError: 'Telegram'
please can you help to fix this issue I cannot find any information t.me link or 1003939039 ID
:;
File "ChannelUsers.py", line 50, in main
my_channel = await client.get_entity(entity)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/telethon/client/users.py", line 335, in get_entity
result.append(await self._get_entity_from_string(x))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/telethon/client/users.py", line 575, in _get_entity_from_string
'Cannot find any entity corresponding to "{}"'.format(string)
ValueError: Cannot find any entity corresponding to ""
Hello,
I had tried your code ChannelMessages.py to retrieve messages from a group I'm a member of.
Unfortunately, no matter how I set the offset-id
I keep getting this error:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1664, in
main()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/Arnold/Programming/Python/Telegram/ChannelMessages.py", line 79, in
if not history.messages:
AttributeError: 'coroutine' object has no attribute 'messages'
Could you please help me to resolve this issue?
Hello!
I got a ban from Telegram :(
telethon.errors.rpcerrorlist.FloodWaitError: A wait of 74263 seconds is required (caused by ResolveUsernameRequest)
How I can fix it?
Hi, when i try to run your script i see this error:
line 43, in
target_group=groups[int(g_index)]
IndexError: cannot fit 'int' into an index-sized integer
two closed the same issue. But their methods do not work.
ChatAdminRequiredError: Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group (caused by GetParticipantsRequest)
I was wondering how to get members of a group, because this script has the file named ChannelUsers.py .. Then I found out groups are actually "improved" channels with just an extra attribute .megagroup = True
So it's possible to get also members from a group with ChannelUsers.py or messages from a group with ChannelMessages.py. IFF they are public. This could be said more clear.
Group members can be extracted IFF the group is public. Most are private!
Group messages can be extracted IFF the group is public. But: if it was first private, and then changed to public later, the extract will only contain the messages after it was changed to public, missing the messages when it still was private (nice feature!)
Same goes I guess for channels, they have to be public.
To close this "issue" maybe we could just improve the README, explaining this?
When I execute the following command:
python3 ChannelUsers.py
It gives the following error:
ChannelUsers.py:30: RuntimeWarning: coroutine 'UserMethods.is_user_authorized' was never awaited
if not client.is_user_authorized():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
enter entity(telegram URL or entity id):Web HackZ
Traceback (most recent call last):
File "ChannelUsers.py", line 57, in
if not participants.users:
AttributeError: 'coroutine' object has no attribute 'users'
sys:1: RuntimeWarning: coroutine 'UserMethods.get_me' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
sys:1: RuntimeWarning: coroutine 'UserMethods.call' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
sys:1: RuntimeWarning: coroutine 'UserMethods.get_entity' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Also please tell, exactly what is Entity Id or Telegram URL ? What are we supposed to write for that parameter.
Hi Amir. why do you think this error comes up ?
OperationalError Traceback (most recent call last)
in
38
39 # Create the client and connect
---> 40 client = TelegramClient(username, api_id, api_hash)
e:\Users\Keram\anaconda3\lib\site-packages\telethon\client\telegrambaseclient.py in init(self, session, api_id, api_hash, connection, use_ipv6, proxy, local_addr, timeout, request_retries, connection_retries, retry_delay, auto_reconnect, sequential_updates, flood_sleep_threshold, raise_last_call_error, device_model, system_version, app_version, lang_code, system_lang_code, loop, base_logger, receive_updates)
271 if isinstance(session, str) or session is None:
272 try:
--> 273 session = SQLiteSession(session)
274 except ImportError:
275 import warnings
e:\Users\Keram\anaconda3\lib\site-packages\telethon\sessions\sqlite.py in init(self, session_id)
45
46 self._conn = None
---> 47 c = self._cursor()
48 c.execute("select name from sqlite_master "
49 "where type='table' and name='version'")
e:\Users\Keram\anaconda3\lib\site-packages\telethon\sessions\sqlite.py in _cursor(self)
226 """Asserts that the connection is open and returns a cursor"""
227 if self._conn is None:
--> 228 self._conn = sqlite3.connect(self.filename,
229 check_same_thread=False)
230 return self._conn.cursor()
OperationalError: unable to open database file
Huge thanks to @amiryousefi! Superior tool!
However, does anyone know if there is a way to pass multiple Telegram channels into the ChannelMessages?
So, the way one JSON file would contain messages from 10+ TG channels? Should be ok given the structure of JSON is the same across all channels.
Thank you!
How to get last message from history, How to automate the script, to get the latest message from the channel as soon as we receive in the channel.
history = client(GetHistoryRequest(
peer=my_channel,
offset_id=offset_id,
offset_date=None,
add_offset=0,
limit=limit,
max_id=0,
min_id=0,
hash=0
))
Thanks
Ikram
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.