Telethon:使用 Python 和 Telethon 抓取 Telegram 组成员

问题描述

我正在尝试在此网站上运行此代码,但出现此错误 https://python.gotrained.com/scraping-telegram-group-members-python-telethon/

任何人都知道我做错了什么

OperationalError                          Traceback (most recent call last)
<ipython-input-2-6ad2f1d4b165> in <module>
     10 api_hash = 'xxxxxxxxxxxxxxxxxxxxxxx'
     11 phone = '+xxxxxxxxxxxx'
---> 12 client = TelegramClient(phone,api_id,api_hash)
     13 
     14 client.connect()

~\anaconda3\lib\site-packages\telethon\client\telegrambaseclient.py in __init__(self,session,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)
    282                 DEFAULT_DC_ID,283                 DEFAULT_IPV6_IP if self._use_ipv6 else DEFAULT_IPV4_IP,--> 284                 DEFAULT_PORT
    285             )
    286 

~\anaconda3\lib\site-packages\telethon\sessions\sqlite.py in set_dc(self,dc_id,server_address,port)
    166     def set_dc(self,port):
    167         super().set_dc(dc_id,port)
--> 168         self._update_session_table()
    169 
    170         # Fetch the auth_key corresponding to this data center

~\anaconda3\lib\site-packages\telethon\sessions\sqlite.py in _update_session_table(self)
    192         # some more work before being able to save auth_key's for
    193         # multiple DCs. Probably done differently.
--> 194         c.execute('delete from sessions')
    195         c.execute('insert or replace into sessions values (?,?,?)',(
    196             self._dc_id,OperationalError: database is locked

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)