Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The phone number is invalid (caused by SendCodeRequest) and no data found to publish site #18

Closed
Lod3 opened this issue May 25, 2021 · 6 comments
Labels
question Further information is requested

Comments

@Lod3
Copy link

Lod3 commented May 25, 2021

Running into this error when running tg-archive --sync

Traceback (most recent call last):
File "/home/lode/.local/bin/tg-archive", line 11, in <module>
sys.exit(main())
File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/__init__.py", line 119, in main
Sync(cfg, args.session, db.DB(args.data)).sync(args.id)
File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/sync.py", line 33, in __init__
self.client.start()
File "/home/lode/.local/lib/python3.6/site-packages/telethon/client/auth.py", line 133, in start
else self.loop.run_until_complete(coro)
File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/home/lode/.local/lib/python3.6/site-packages/telethon/client/auth.py", line 189, in _start
await self.send_code_request(phone, force_sms=force_sms)
File "/home/lode/.local/lib/python3.6/site-packages/telethon/client/auth.py", line 515, in send_code_request
phone, self.api_id, self.api_hash, types.CodeSettings()))
File "/home/lode/.local/lib/python3.6/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "/home/lode/.local/lib/python3.6/site-packages/telethon/client/users.py", line 79, in _call
result = await future
telethon.errors.rpcerrorlist.PhoneNumberInvalidError: The phone number is invalid (caused by SendCodeRequest)

session.session file is created though, running tg-archive --build gives
2021-05-25 17:02:31,213: building site 2021-05-25 17:02:31,236: no data found to publish site

Do I need to paste the group ID with "@" in the yaml file?
This is my yaml file, do I need to edit something?:

# Telegram API ID and hash from the Telegram dev portal.
# Signup for it here: https://my.telegram.org/auth?to=apps
api_id: "redacted"
api_hash: "redacted"
# Telegram channel / group name to import. Your user account
# that was used to creat the API ID should be a member of this group.
group: "redacted"
# Avatars and media will be downloaded into media_dir.
download_media: True
download_avatars: True
avatar_size: [64, 64] # Width, Height.
media_dir: "media"
# These should be configured carefully to not get rate limited by Telegram.
# Number of messages to fetch in one batch.
fetch_batch_size: 2000
# Seconds to wait after fetching one full batch and moving on to the next one.
fetch_wait: 5
# Max number of messages to fetch across all batches before the stopping.
# This should be greater than fetch_batch_size.
# Set to 0 to never stop until all messages have been fetched.
fetch_limit: 0
publish_dir: "site"
static_dir: "static"
per_page: 500
show_day_index: True
# URL to link Telegram group names and usernames.
telegram_url: "https://t.me/{id}"
# IMPORTANT: Telegram shows the full name on your (API key holder's)
# phonebook for users who are in your phonebook.
show_sender_fullname: False
publish_rss_feed: True
rss_feed_entries: 100 # Show Latest N messages in the RSS feed.
# Root URL where the site will be hosted. No trailing slash.
site_url: "https://mysite.com"
site_name: "@{group} - Telegram group archive"
site_description: "Public archive of Telegram messages."
meta_description: "@{group} {date} - Telegram message archive."
page_title: "Page {page} - {date} @{group} Telegram message archive."
                                                                                                                                                                                                                          
@Lod3 Lod3 changed the title The phone number is invalid (caused by SendCodeRequest) and no data found to publish site ` The phone number is invalid (caused by SendCodeRequest) and no data found to publish site May 25, 2021
@knadh
Copy link
Owner

knadh commented May 25, 2021

Do I need to paste the group ID with "@" in the yaml file?

No, the just the group ID is enough. eg: fossunited

The phone number is invalid (caused by SendCodeRequest)

Looks like you are specifying an invalid phone number, so clearly the OTP auth + actual session creation has not happened. Delete the session file and try again with a country code prefixed phone number. eg: +91123456789.

@knadh knadh added the question Further information is requested label May 25, 2021
@Lod3
Copy link
Author

Lod3 commented May 25, 2021

Thank you!
Got there indeed the country code was the mistake, was typing the country code and pasting the rest.
It went ahead, and send the verification code in Telegram. When I run tg-archive --sync
The errors are now:

2021-05-25 17:32:50,249: Failed to load SSL library: <class 'OSError'> (no library called "ssl" found) 2021-05-25 17:32:50,519: starting Telegram sync (batch_size=2000, limit=0, wait=5) 2021-05-25 17:32:50,526: Connecting to 149.154.167.91:443/TcpFull... 2021-05-25 17:32:50,546: Connection to 149.154.167.91:443/TcpFull complete! 2021-05-25 17:32:50,566: The server closed the connection 2021-05-25 17:32:50,566: Connection closed while receiving data 2021-05-25 17:32:50,569: Closing current connection to begin reconnect... 2021-05-25 17:32:50,570: Connecting to 149.154.167.91:443/TcpFull... 2021-05-25 17:32:50,591: Connection to 149.154.167.91:443/TcpFull complete! 2021-05-25 17:32:51,657: downloading avatar #1880607048 2021-05-25 17:32:51,737: error downloading avatar: #1880607048: cannot identify image file <_io.BytesIO object at 0x000001BB40605090> 2021-05-25 17:32:51,737: downloading avatar #1893680481 2021-05-25 17:32:51,740: error downloading avatar: #1893680481: cannot identify image file <_io.BytesIO object at 0x000001BB40867C70> 2021-05-25 17:32:51,741: downloading avatar #1893680481 2021-05-25 17:32:51,741: error downloading avatar: #1893680481: cannot identify image file <_io.BytesIO object at 0x000001BB4086C270> 2021-05-25 17:32:51,742: downloading avatar #1639782558 2021-05-25 17:32:51,742: error downloading avatar: #1639782558: cannot identify image file <_io.BytesIO object at 0x000001BB4086C2C0> 2021-05-25 17:32:51,744: downloading avatar #1632773503 2021-05-25 17:32:51,744: error downloading avatar: #1632773503: cannot identify image file <_io.BytesIO object at 0x000001BB4086C4A0> 2021-05-25 17:32:51,751: downloading avatar #1864639196 2021-05-25 17:32:51,751: error downloading avatar: #1864639196: cannot identify image file <_io.BytesIO object at 0x000001BB4086C540> 2021-05-25 17:32:51,752: downloading avatar #1547928260 2021-05-25 17:32:51,753: error downloading avatar: #1547928260: cannot identify image file <_io.BytesIO object at 0x000001BB4086C4F0> 2021-05-25 17:32:51,758: downloading avatar #1864639196 2021-05-25 17:32:51,758: error downloading avatar: #1864639196: cannot identify image file <_io.BytesIO object at 0x000001BB4086C5E0> 2021-05-25 17:32:51,759: downloading avatar #1707481749 2021-05-25 17:32:51,759: error downloading avatar: #1707481749: cannot identify image file <_io.BytesIO object at 0x000001BB4086C860> 2021-05-25 17:32:51,760: downloading avatar #1867406902 2021-05-25 17:32:51,760: error downloading avatar: #1867406902: cannot identify image file <_io.BytesIO object at 0x000001BB4086C950> 2021-05-25 17:32:51,762: downloading avatar #1115737285 2021-05-25 17:32:51,762: error downloading avatar: #1115737285: cannot identify image file <_io.BytesIO object at 0x000001BB4086C9A0> 2021-05-25 17:32:51,769: downloading avatar #1751041962 2021-05-25 17:32:51,773: error downloading avatar: #1751041962: cannot identify image file <_io.BytesIO object at 0x000001BB4086CC20> 2021-05-25 17:32:51,774: downloading avatar #1864639196 2021-05-25 17:32:51,774: error downloading avatar: #1864639196: cannot identify image file <_io.BytesIO object at 0x000001BB4086CD60> 2021-05-25 17:32:51,775: downloading avatar #1675607009 2021-05-25 17:32:51,775: error downloading avatar: #1675607009: cannot identify image file <_io.BytesIO object at 0x000001BB4086CEA0> 2021-05-25 17:32:51,775: downloading media #27 2021-05-25 17:32:51,777: Starting direct file download in chunks of 131072 at 0, stride 131072 2021-05-25 17:32:51,814: Starting direct file download in chunks of 131072 at 0, stride 131072 2021-05-25 17:32:51,855: downloading avatar #1872302161 2021-05-25 17:32:51,855: error downloading avatar: #1872302161: cannot identify image file <_io.BytesIO object at 0x000001BB40876360> 2021-05-25 17:32:51,859: downloading avatar #1707481749 2021-05-25 17:32:51,859: error downloading avatar: #1707481749: cannot identify image file <_io.BytesIO object at 0x000001BB408764F0> 2021-05-25 17:32:51,859: downloading avatar #1774859119 2021-05-25 17:32:51,860: error downloading avatar: #1774859119: cannot identify image file <_io.BytesIO object at 0x000001BB40876590> 2021-05-25 17:32:51,861: downloading avatar #1718198442 2021-05-25 17:32:51,862: error downloading avatar: #1718198442: cannot identify image file <_io.BytesIO object at 0x000001BB40876720> 2021-05-25 17:32:51,868: downloading avatar #1681021111 2021-05-25 17:32:51,868: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB40876860> 2021-05-25 17:32:51,869: downloading avatar #1681021111 2021-05-25 17:32:51,869: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB40876900> 2021-05-25 17:32:51,870: downloading avatar #1681021111 2021-05-25 17:32:51,870: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB408768B0> 2021-05-25 17:32:51,871: downloading avatar #1707610380 2021-05-25 17:32:51,871: error downloading avatar: #1707610380: cannot identify image file <_io.BytesIO object at 0x000001BB40876CC0> 2021-05-25 17:32:51,872: downloading avatar #1294697289 2021-05-25 17:32:51,872: error downloading avatar: #1294697289: cannot identify image file <_io.BytesIO object at 0x000001BB40876D60> 2021-05-25 17:32:51,873: downloading avatar #1707481749 2021-05-25 17:32:51,873: error downloading avatar: #1707481749: cannot identify image file <_io.BytesIO object at 0x000001BB40876D10> 2021-05-25 17:32:51,874: downloading avatar #1707481749 2021-05-25 17:32:51,874: error downloading avatar: #1707481749: cannot identify image file <_io.BytesIO object at 0x000001BB40876E00> 2021-05-25 17:32:51,874: downloading media #46 2021-05-25 17:32:51,876: Starting direct file download in chunks of 131072 at 0, stride 131072 2021-05-25 17:32:51,976: Starting direct file download in chunks of 131072 at 0, stride 131072 2021-05-25 17:32:52,014: downloading avatar #1707481749 2021-05-25 17:32:52,014: error downloading avatar: #1707481749: cannot identify image file <_io.BytesIO object at 0x000001BB40876EF0> 2021-05-25 17:32:52,018: downloading avatar #1708483535 2021-05-25 17:32:52,019: error downloading avatar: #1708483535: cannot identify image file <_io.BytesIO object at 0x000001BB4087A1D0> 2021-05-25 17:32:52,019: downloading avatar #781095242 2021-05-25 17:32:52,019: error downloading avatar: #781095242: cannot identify image file <_io.BytesIO object at 0x000001BB4087A3B0> 2021-05-25 17:32:52,020: downloading avatar #1504625319 2021-05-25 17:32:52,020: error downloading avatar: #1504625319: cannot identify image file <_io.BytesIO object at 0x000001BB4087A4F0> 2021-05-25 17:32:52,021: downloading avatar #1691749202 2021-05-25 17:32:52,021: error downloading avatar: #1691749202: cannot identify image file <_io.BytesIO object at 0x000001BB4087A590> 2021-05-25 17:32:52,022: downloading avatar #1850887073 2021-05-25 17:32:52,022: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087A540> 2021-05-25 17:32:52,023: downloading avatar #1850887073 2021-05-25 17:32:52,023: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087A770> 2021-05-25 17:32:52,024: downloading avatar #1850887073 2021-05-25 17:32:52,024: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087A950> 2021-05-25 17:32:52,025: downloading avatar #1215290474 2021-05-25 17:32:52,025: error downloading avatar: #1215290474: cannot identify image file <_io.BytesIO object at 0x000001BB4087AC70> 2021-05-25 17:32:52,026: downloading avatar #1850887073 2021-05-25 17:32:52,026: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087AD10> 2021-05-25 17:32:52,027: downloading avatar #1215290474 2021-05-25 17:32:52,028: error downloading avatar: #1215290474: cannot identify image file <_io.BytesIO object at 0x000001BB4087B130> 2021-05-25 17:32:52,029: downloading avatar #1576565460 2021-05-25 17:32:52,035: error downloading avatar: #1576565460: cannot identify image file <_io.BytesIO object at 0x000001BB4087B270> 2021-05-25 17:32:52,041: downloading avatar #1850887073 2021-05-25 17:32:52,042: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087B3B0> 2021-05-25 17:32:52,043: downloading avatar #1850887073 2021-05-25 17:32:52,043: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087B590> 2021-05-25 17:32:52,045: downloading avatar #1850887073 2021-05-25 17:32:52,045: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087B810> 2021-05-25 17:32:52,051: downloading avatar #1867925334 2021-05-25 17:32:52,055: error downloading avatar: #1867925334: cannot identify image file <_io.BytesIO object at 0x000001BB4087B8B0> 2021-05-25 17:32:52,056: downloading avatar #1790755682 2021-05-25 17:32:52,056: error downloading avatar: #1790755682: cannot identify image file <_io.BytesIO object at 0x000001BB4087B860> 2021-05-25 17:32:52,057: downloading avatar #1681021111 2021-05-25 17:32:52,057: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB4087BAE0> 2021-05-25 17:32:52,058: downloading avatar #1850887073 2021-05-25 17:32:52,058: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087BCC0> 2021-05-25 17:32:52,058: downloading avatar #1681021111 2021-05-25 17:32:52,059: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB4087BD60> 2021-05-25 17:32:52,059: downloading avatar #1077088831 2021-05-25 17:32:52,060: error downloading avatar: #1077088831: cannot identify image file <_io.BytesIO object at 0x000001BB4087BEA0> 2021-05-25 17:32:52,060: downloading avatar #1850887073 2021-05-25 17:32:52,061: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4087BF40> 2021-05-25 17:32:52,062: downloading avatar #1850887073 2021-05-25 17:32:52,062: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB405E8EF0> 2021-05-25 17:32:52,068: downloading avatar #1681021111 2021-05-25 17:32:52,074: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB405E8F90> 2021-05-25 17:32:52,074: downloading avatar #1850887073 2021-05-25 17:32:52,075: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4086C360> 2021-05-25 17:32:52,075: downloading avatar #1867925334 2021-05-25 17:32:52,076: error downloading avatar: #1867925334: cannot identify image file <_io.BytesIO object at 0x000001BB4086C400> 2021-05-25 17:32:52,078: downloading avatar #1681021111 2021-05-25 17:32:52,085: error downloading avatar: #1681021111: cannot identify image file <_io.BytesIO object at 0x000001BB4086C450> 2021-05-25 17:32:52,086: downloading avatar #1790755682 2021-05-25 17:32:52,087: error downloading avatar: #1790755682: cannot identify image file <_io.BytesIO object at 0x000001BB4086C4F0> 2021-05-25 17:32:52,089: downloading avatar #1850887073 2021-05-25 17:32:52,090: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4086C590> 2021-05-25 17:32:52,091: downloading avatar #1691749202 2021-05-25 17:32:52,092: error downloading avatar: #1691749202: cannot identify image file <_io.BytesIO object at 0x000001BB4086C680> 2021-05-25 17:32:52,093: downloading avatar #216709910 2021-05-25 17:32:52,095: error downloading avatar: #216709910: cannot identify image file <_io.BytesIO object at 0x000001BB4086C720> 2021-05-25 17:32:52,096: downloading avatar #1850887073 2021-05-25 17:32:52,103: error downloading avatar: #1850887073: cannot identify image file <_io.BytesIO object at 0x000001BB4086C860> Traceback (most recent call last): File "C:\Users\lode_\AppData\Local\Programs\Python\Python39\Scripts\tg-archive-script.py", line 33, in <module> sys.exit(load_entry_point('tg-archive==0.3.4', 'console_scripts', 'tg-archive')()) File "c:\users\lode_\appdata\local\programs\python\python39\lib\site-packages\tgarchive\__init__.py", line 112, in main Sync(cfg, args.session, db.DB(args.data)).sync(args.id) File "c:\users\lode_\appdata\local\programs\python\python39\lib\site-packages\tgarchive\sync.py", line 60, in sync for m in self._get_messages(group_id, File "c:\users\lode_\appdata\local\programs\python\python39\lib\site-packages\tgarchive\sync.py", line 121, in _get_messages med = self._make_poll(m) File "c:\users\lode_\appdata\local\programs\python\python39\lib\site-packages\tgarchive\sync.py", line 182, in _make_poll for i, r in enumerate(msg.media.results.results): TypeError: 'NoneType' object is not iterable

In windows Powershell

And in Ubuntu:

tg-archive --sync
2021-05-25 17:37:43,422: starting Telegram sync (batch_size=2000, limit=0, wait=5)
2021-05-25 17:37:43,425: Connecting to 149.154.167.91:443/TcpFull...
2021-05-25 17:37:43,448: Connection to 149.154.167.91:443/TcpFull complete!
2021-05-25 17:37:43,466: The server closed the connection
2021-05-25 17:37:43,466: Connection closed while receiving data
2021-05-25 17:37:43,467: Closing current connection to begin reconnect...
2021-05-25 17:37:43,467: Connecting to 149.154.167.91:443/TcpFull...     
2021-05-25 17:37:43,489: Connection to 149.154.167.91:443/TcpFull complete!
Traceback (most recent call last):
  File "/home/lode/.local/bin/tg-archive", line 11, in <module>
    sys.exit(main())
  File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/__init__.py", line 119, in main
    Sync(cfg, args.session, db.DB(args.data)).sync(args.id)
  File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/sync.py", line 69, in sync      
    self.db.insert_user(m.user)
  File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/db.py", line 174, in insert_user
    """, (u.id, u.username, u.first_name, u.last_name, " ".join(u.tags), u.avatar))
sqlite3.OperationalError: near "ON": syntax error

Running tg-archive --build results in

2021-05-25 17:38:43,081: building site
2021-05-25 17:38:43,103: no data found to publish site

@knadh knadh closed this as completed in 572d16f May 27, 2021
@knadh
Copy link
Owner

knadh commented May 27, 2021

Can you try and upgrade to v0.3.6?

@Lod3
Copy link
Author

Lod3 commented May 27, 2021

Of course:

lode@desktop-terminus:~$ tg-archive --version
v0.3.6
lode@desktop-terminus:~/telegram-group-folder$ tg-archive --sync
2021-05-27 16:57:20,429: starting Telegram sync (batch_size=2000, limit=0, wait=5)
2021-05-27 16:57:20,432: Connecting to 149.154.167.51:443/TcpFull...
2021-05-27 16:57:20,452: Connection to 149.154.167.51:443/TcpFull complete!
Please enter your phone (or bot token): +redacted
2021-05-27 16:57:37,535: Phone migrated to 4
2021-05-27 16:57:37,558: Reconnecting to new data center 4
2021-05-27 16:57:37,597: Disconnecting from 149.154.167.51:443/TcpFull...
2021-05-27 16:57:37,597: Disconnection from 149.154.167.51:443/TcpFull complete!
2021-05-27 16:57:37,598: Connecting to 149.154.167.91:443/TcpFull...
2021-05-27 16:57:37,973: Connection to 149.154.167.91:443/TcpFull complete!
Please enter the code you received: redacted
Signed in successfully as redacted
2021-05-27 16:57:47,910: downloading avatar #1520078789
2021-05-27 16:57:47,910: Starting direct file download in chunks of 65536 at 0, stride 65536
Traceback (most recent call last):
  File "/home/lode/.local/bin/tg-archive", line 8, in <module>
    sys.exit(main())
  File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/__init__.py", line 119, in main
    Sync(cfg, args.session, db.DB(args.data)).sync(args.id)
  File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/sync.py", line 69, in sync
    self.db.insert_user(m.user)
  File "/home/lode/.local/lib/python3.6/site-packages/tgarchive/db.py", line 174, in insert_user
    """, (u.id, u.username, u.first_name, u.last_name, " ".join(u.tags), u.avatar))
sqlite3.OperationalError: near "ON": syntax error
lode@desktop-terminus:~/Als1manachterjurgen$ tg-archive --build
2021-05-27 17:02:37,245: building site
2021-05-27 17:02:37,268: no data found to publish site

This is via terminus using WSL2 ubuntu 18

@Lod3
Copy link
Author

Lod3 commented May 27, 2021

Ok I think it works on Windows Powershell! Nice!

I can see media showing up.
I guess now I need to know how to open the data.sqlite file.

AIds39ACou.mp4

@knadh
Copy link
Owner

knadh commented Jun 7, 2021

I guess now I need to know how to open the data.sqlite file.

https://sqlitebrowser.org is great for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants