Code Monkey home page Code Monkey logo

telegram-analysis's Introduction

Hi there ๐Ÿ‘‹

telegram-analysis's People

Contributors

a-yousefi avatar amiryousefi avatar deraswer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telegram-analysis's Issues

Seener

=||||||||||||||||||||||||||||||

Error Found.

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")

FloodWaitError

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?

How to get last message from history = client(GetHistoryRequest())

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

OperationalError: unable to open database file

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

cannot import functions from telethon.tl

ImportError: cannot import name 'functions' from 'telethon.tl' (C:\ProgramData\Telethon-daf\Telethon-daf21f12d9c183351fef8e10373a13aa6f51f191\telethon\tl_init_.py)

AttributeError: 'coroutine' object has no attribute 'messages'

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?

It says File Section Header not found

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

Cannot find any entity corresponding to ""

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")

how to bypass this problem

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)

Hint: Telegram groups are actually channels, too.. members and messages can be extracted, iff..

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.

  1. Group members can be extracted IFF the group is public. Most are private!

  2. 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?

not working without good format ID or Link

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 ""

AttributeError: 'coroutine' object has no attribute 'users'

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.

Is there a way to pass multiple Telegram channels?

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!

configparser.py issue help please

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'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.