danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.86k stars 661 forks source link

Doesn't download some files, Help. #765

Closed sarelic closed 4 years ago

sarelic commented 4 years ago

Message example

{"_":"message","out":false,"mentioned":false,"media_unread":false,"silent":false,"post":true,"from_scheduled":false,"legacy":false,"edit_hide":false,"id":195912,"to_id":{"_":"peerChannel","channel_id":1082084045},"fwd_from":{"_":"messageFwdHeader","date":1581100597,"channel_id":1046446760,"channel_post":30060},"date":1581100755,"message":"\u041f\u043e\u0441\u043b\u0435 \u043a\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0442\u043e\u043b\u0435\u0442\u0430 \u0432 \u0422\u0430\u0442\u0430\u0440\u0441\u0442\u0430\u043d\u0435 \u0421\u041a \u0432\u043e\u0437\u0431\u0443\u0434\u0438\u043b \u0443\u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0435 \u0434\u0435\u043b\u043e \u043e \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u0430\u0432\u0438\u043b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u0434\u0443\u0448\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430, \u043f\u043e\u0432\u043b\u0435\u043a\u0448\u0435\u043c \u0441\u043c\u0435\u0440\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0412\u043e\u0442, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0448\u0435\u0441\u0442\u0432\u0438\u044f.\n\n@tv360ru","media":{"_":"messageMediaDocument","document":{"_":"document","id":5328226355995740019,"access_hash":2957327845024932018,"file_reference":{"_":"bytes","bytes":"AkB\/Ss0AAv1IXj\/NLcp\/Xco0Axetgm3ie5J4WKI="},"date":1581100596,"mime_type":"video\/mp4","size":11462827,"thumbs":[{"_":"photoStrippedSize","type":"i","bytes":{"_":"bytes","bytes":"ARYorJALhQV2pjjk9fwqKW2aLbuI+boBUkThICxUn5uvpUMkhduc47DPSpGMZCvUY+tNAyasXEwmbIXt+VMWIlQ21sHgHHBoegERA7c0VP8AZ8vt5Bx3GKKXMgsXbdEe1QtnIH9aDZwHPB+uaKKsA+ywbNoDZ+tMWGJQADJx78UUUgHqkYbcC3480UUUrIA="}},{"_":"photoSize","type":"m","location":{"_":"fileLocationToBeDeprecated","volume_id":266216399,"local_id":34142},"w":320,"h":180,"size":14893}],"dc_id":2,"attributes":[{"_":"documentAttributeVideo","round_message":false,"supports_streaming":true,"duration":29,"w":1280,"h":720},{"_":"documentAttributeFilename","file_name":"11.mp4"}]}},"entities":[{"_":"messageEntityBold","offset":0,"length":65},{"_":"messageEntityMention","offset":222,"length":8}],"views":65690}

This messageMediaDocument Info File from $MadelineProto->getDownloadInfo($arrmessage["media"]);

array(6) { ["MessageMedia"]=> array(2) { ["_"]=> string(20) "messageMediaDocument" ["document"]=> array(10) { ["_"]=> string(8) "document" ["id"]=> int(5328226355995740019) ["access_hash"]=> int(2957327845024932018) ["file_reference"]=> object(danog\MadelineProto\TL\Types\Bytes)#831 (1) { ["bytes":"danog\MadelineProto\TL\Types\Bytes":private]=> string(29) "@J��H^?�-�]�4��m�{�xX�" } ["date"]=> int(1581100596) ["mime_type"]=> string(9) "video/mp4" ["size"]=> int(11462827) ["thumbs"]=> array(2) { [0]=> array(3) { ["_"]=> string(17) "photoStrippedSize" ["type"]=> string(1) "i" ["bytes"]=> object(danog\MadelineProto\TL\Types\Bytes)#41 (1) { ["bytes":"danog\MadelineProto\TL\Types\Bytes":private]=> string(143) "(���v�8���*)m�-����RD� ,T����C$�ۜ��J��d+�c�M&�\L&l���S"T6���phz�4T�g���w��2m��g Z �<�h���l�g�LXbP2q��Rꑆ�~<�E��" } } [1]=> array(6) { ["_"]=> string(9) "photoSize" ["type"]=> string(1) "m" ["location"]=> array(3) { ["_"]=> string(26) "fileLocationToBeDeprecated" ["volume_id"]=> int(266216399) ["local_id"]=> int(34142) } ["w"]=> int(320) ["h"]=> int(180) ["size"]=> int(14893) } } ["dc_id"]=> int(2) ["attributes"]=> array(2) { [0]=> array(6) { ["_"]=> string(22) "documentAttributeVideo" ["round_message"]=> bool(false) ["supports_streaming"]=> bool(true) ["duration"]=> int(29) ["w"]=> int(1280) ["h"]=> int(720) } [1]=> array(2) { ["_"]=> string(25) "documentAttributeFilename" ["file_name"]=> string(6) "11.mp4" } } } } ["ext"]=> string(4) ".mp4" ["name"]=> string(22) "11_5328226355995740019" ["InputFileLocation"]=> array(6) { ["_"]=> string(25) "inputDocumentFileLocation" ["id"]=> int(5328226355995740019) ["access_hash"]=> int(2957327845024932018) ["version"]=> int(0) ["dc_id"]=> int(2) ["file_reference"]=> string(29) "@J��H^?�-�]�4��m�{�xX�" } ["size"]=> int(11462827) ["mime"]=> string(9) "video/mp4" }

ext .mp4 name 11_5328226355995740019 mime video/mp4 size 11462827

My code

echo "</br>messageMediaDocument</br>";
try {
$info = $MadelineProto->getDownloadInfo($arrmessage["media"]);
var_dump($info); //exit;
echo '</br>';
echo $info['ext'].'</br>';
echo $info['name'] .'</br>';
echo $info['mime'] .'</br>';
echo $info['size'] .'</br>';
$mediaurl = $MadelineProto->downloadToFile($arrmessage["media"], __DIR__.'/tmp/'.$info['name'].$info['ext']);
}
catch (\danog\MadelineProto\TL\Exception $e) {
     var_dump($e); echo 'TEST 123'; exit;
}
finally
{
     echo 'finally';
}

Response:

object(danog\MadelineProto\TL\Exception)#2292 (10) { ["message":protected]=> string(17) "Length is too big" 

TL Trace:
Loop.php(61): loop()
loopImpl()

Previous TL trace:

TL.php(970): deserialize()
TL.php(970): deserialize()
ReadLoop.php(221): deserialize()
readMessage()
Coroutine.php(116): send()
Placeholder.php(130): danog\MadelineProto\{closure}()
Coroutine.php(127): resolve()
Placeholder.php(130): danog\MadelineProto\{closure}()
Deferred.php(45): resolve()
ResourceInputStream.php(109): resolve()
Driver.php(116): Amp\ByteStream\{closure}()
Driver.php(72): tick()
Loop.php(84): run()
Tools.php(304): run()
AbstractAPIFactory.php(105): wait()
InternalDoc.php(4551): __call()
index.php(214): downloadToFile()
index.php(116): PARSEids()" ["method":"danog\MadelineProto\TL\Exception":private]=> string(0) "" ["updated":"danog\MadelineProto\TL\Exception":private]=> bool(true) } 
danog commented 4 years ago

Please try again, but with full ULTRA_VERBOSE logs and exceptions logged using echo $e; not var_dump($e);

danog commented 4 years ago

Also the stuff with downloadToFile is useless, just use downloadToDir

sarelic commented 4 years ago

So? Sorry if I don't understand you. $MadelineProto = new \danog\MadelineProto\API('session.madeline'); $MadelineProto->logger($MadelineProto, \danog\MadelineProto\Logger::ULTRA_VERBOSE); $MadelineProto->start();

` [09-Feb-2020 18:09:53 Europe/Helsinki] Enabled PHP logging [09-Feb-2020 18:09:53 Europe/Helsinki] Enabled PHP logging Logger: MadelineProto Logger: Copyright (C) 2016-2019 Daniil Gentili Logger: Licensed under AGPLv3 Logger: https://github.com/danog/MadelineProto API: Waiting for shared lock of serialization lockfile... API: Shared lock acquired, deserializing... [09-Feb-2020 18:09:53 Europe/Helsinki] Enabled PHP logging [09-Feb-2020 18:09:53 Europe/Helsinki] Enabled PHP logging DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Disconnecting all before reconnect! DataCenterConnection, 1031528421: Disconnecting from shared DC DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC DataCenter, 1031528421: Reconnecting to DC 2 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.51:443 main DC 2, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 2.0 DataCenter, 1031528421: Reconnecting to DC 1 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.175.53:443 main DC 1, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 1.0 DataCenter, 1031528421: Reconnecting to DC 2_media (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.151:443 main DC 2_media, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 2_media.0 DataCenter, 1031528421: Reconnecting to DC 3 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.175.100:443 main DC 3, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 3.0 DataCenter, 1031528421: Reconnecting to DC 4 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.92:443 main DC 4, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 4.0 DataCenter, 1031528421: Reconnecting to DC 4_media (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.165.120:443 main DC 4_media, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 4_media.0 DataCenter, 1031528421: Reconnecting to DC 5 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://91.108.56.184:443 main DC 5, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) Connection, 1031528421: Connecting to DC 5.0 Connection, 1031528421: Connected to DC 2.0! DataCenterConnection, 1031528421: Restoring 0 messages to DC 2 DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 2_media.0! Connection, 1031528421: Connecting to DC 2_media.1 Connection, 1031528421: Connected to DC 4.0! DataCenterConnection, 1031528421: Restoring 0 messages to DC 4 DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 4_media.0! Connection, 1031528421: Connecting to DC 4_media.1 Connection, 1031528421: Connected to DC 2_media.1! Connection, 1031528421: Connecting to DC 2_media.2 ReadLoop, 1031528421: danog\MadelineProto\NothingInTheSocketException in phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php:180 Stack trace:

0 [internal function]: danog\MadelineProto\Stream\Common\BufferedRawStream->bufferReadGenerator()

1 phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Coroutine.php(116): Generator->send()

2 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Internal/Placeholder.php(130): danog\MadelineProto\Coroutine->danog\MadelineProto{closure}()

3 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Deferred.php(45): class@anonymous->resolve()

4 phar:///var/www/html/a/madeline.phar/vendor/amphp/byte-stream/lib/ResourceInputStream.php(101): Amp\Deferred->resolve()

5 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/NativeDriver.php(192): Amp\ByteStream\ResourceInputStream::Amp\ByteStream{closure}()

6 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/NativeDriver.php(97): Amp\Loop\NativeDriver->selectStreams()

7 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/Driver.php(134): Amp\Loop\NativeDriver->dispatch()

8 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()

9 phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop.php(84): Amp\Loop\Driver->run()

10 phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Tools.php(304): Amp\Loop::run()

11 phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/AbstractAPIFactory.php(105): danog\MadelineProto\Tools::wait()

12 phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/InternalDoc.php(5626): danog\MadelineProto\AbstractAPIFactory->__call()

13 /var/www/html/a/index.php(21): danog\MadelineProto\InternalDoc->start()

14 {main}

ReadLoop, 1031528421: Got nothing in the socket in DC 4.0, reconnecting... Connection, 1031528421: Reconnecting DC 4.0 Connection, 1031528421: Disconnecting from DC 4.0 Connection, 1031528421: Disconnected from DC 4.0 DataCenter, 1031528421: Reconnecting to DC 4 (0) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.92:443 main DC 4, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (0) Connection, 1031528421: Connecting to DC 4.0 Connection, 1031528421: Connected to DC 4_media.1! Connection, 1031528421: Connecting to DC 4_media.2 Connection, 1031528421: Connected to DC 2_media.2! Connection, 1031528421: Connecting to DC 2_media.3 Connection, 1031528421: Connected to DC 4.0! DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 4_media.2! Connection, 1031528421: Connecting to DC 4_media.3 Connection, 1031528421: Connected to DC 1.0! DataCenterConnection, 1031528421: Restoring 0 messages to DC 1 DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 2_media.3! Connection, 1031528421: Connecting to DC 2_media.4 Connection, 1031528421: Connected to DC 3.0! DataCenterConnection, 1031528421: Restoring 0 messages to DC 3 DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 4_media.3! Connection, 1031528421: Connecting to DC 4_media.4 Connection, 1031528421: Connected to DC 5.0! DataCenterConnection, 1031528421: Restoring 0 messages to DC 5 DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 2_media.4! DataCenterConnection, 1031528421: Restoring 0 messages to DC 2_media DataCenter, 1031528421: OK! Connection, 1031528421: Connected to DC 4_media.4! DataCenterConnection, 1031528421: Restoring 0 messages to DC 4_media DataCenter, 1031528421: OK! MTProto, 1031528421: Initing authorization... MTProto, 1031528421: Initing authorization DC 2... MTProto, 1031528421: Done initing authorization DC 2 MTProto, 1031528421: Initing authorization DC 1... MTProto, 1031528421: Done initing authorization DC 1 MTProto, 1031528421: Initing authorization DC 3... MTProto, 1031528421: Done initing authorization DC 3 MTProto, 1031528421: Initing authorization DC 4... MTProto, 1031528421: Done initing authorization DC 4 MTProto, 1031528421: Initing authorization DC 5... MTProto, 1031528421: Done initing authorization DC 5 MTProto, 1031528421: Initing authorization DC 2_media... MTProto, 1031528421: Done initing authorization DC 2_media MTProto, 1031528421: Initing authorization DC 4_media... MTProto, 1031528421: Done initing authorization DC 4media MTProto, 1031528421: Updated config! MTProto, 1031528421: { "": "config", "phonecalls_enabled": false, "default_p2p_contacts": true, "preload_featured_stickers": false, "ignore_phone_entities": false, "revoke_pm_inbox": true, "blocked_mode": true, "pfs_enabled": false, "date": 1581198866, "expires": 1581201969, "test_mode": false, "this_dc": 4, "dc_txt_domain_name": "apv3.stel.com", "chat_size_max": 200, "megagroup_size_max": 200000, "forwarded_count_max": 100, "online_update_period_ms": 210000, "offline_blur_timeout_ms": 5000, "offline_idle_timeout_ms": 30000, "online_cloud_timeout_ms": 300000, "notify_cloud_delay_ms": 30000, "notify_default_delay_ms": 1500, "push_chat_period_ms": 60000, "push_chat_limit": 2, "saved_gifs_limit": 200, "edit_time_limit": 172800, "revoke_time_limit": 2147483647, "revoke_pm_time_limit": 2147483647, "rating_e_decay": 2419200, "stickers_recent_limit": 200, "stickers_faved_limit": 5, "channels_read_media_period": 604800, "pinned_dialogs_count_max": 5, "pinned_infolder_count_max": 100, "call_receive_timeout_ms": 20000, "call_ring_timeout_ms": 90000, "call_connect_timeout_ms": 30000, "call_packet_timeout_ms": 10000, "me_url_prefix": "https://t.me/", "gif_search_username": "gif", "venue_search_username": "foursquare", "img_search_username": "bing", "caption_length_max": 1024, "message_length_max": 4096, "webfile_dc_id": 4 } DataCenter, 1031528421: Reconnecting to DC 2 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.51:443 main DC 2, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! DataCenter, 1031528421: Reconnecting to DC 1 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.175.53:443 main DC 1, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! DataCenter, 1031528421: Reconnecting to DC 2_media (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.151:443 main DC 2_media, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! DataCenter, 1031528421: Reconnecting to DC 3 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.175.100:443 main DC 3, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! DataCenter, 1031528421: Reconnecting to DC 4 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.167.92:443 main DC 4, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! DataCenter, 1031528421: Reconnecting to DC 4_media (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://149.154.165.120:443 main DC 4_media, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! DataCenter, 1031528421: Reconnecting to DC 5 (-1) from existing DataCenterConnection, 1031528421: Trying shared connection via tcp://91.108.56.184:443 main DC 5, via ipv4 using AbridgedStream => BufferedRawStream => DefaultStream (-1) MTProto, 1031528421: Already connected! DataCenter, 1031528421: OK! MTProto, 1031528421: Initing authorization... MTProto, 1031528421: Initing authorization DC 2... MTProto, 1031528421: Done initing authorization DC 2 MTProto, 1031528421: Initing authorization DC 1... MTProto, 1031528421: Done initing authorization DC 1 MTProto, 1031528421: Initing authorization DC 3... MTProto, 1031528421: Done initing authorization DC 3 MTProto, 1031528421: Initing authorization DC 4... MTProto, 1031528421: Done initing authorization DC 4 MTProto, 1031528421: Initing authorization DC 5... MTProto, 1031528421: Done initing authorization DC 5 MTProto, 1031528421: Initing authorization DC 2_media... MTProto, 1031528421: Done initing authorization DC 2_media MTProto, 1031528421: Initing authorization DC 4_media... MTProto, 1031528421: Done initing authorization DC 4media MTProto, 1031528421: Updated config! MTProto, 1031528421: { "": "config", "phonecalls_enabled": false, "default_p2p_contacts": true, "preload_featured_stickers": false, "ignore_phone_entities": false, "revoke_pm_inbox": true, "blocked_mode": true, "pfs_enabled": false, "date": 1581198866, "expires": 1581201969, "test_mode": false, "this_dc": 4, "dc_txt_domain_name": "apv3.stel.com", "chat_size_max": 200, "megagroup_size_max": 200000, "forwarded_count_max": 100, "online_update_period_ms": 210000, "offline_blur_timeout_ms": 5000, "offline_idle_timeout_ms": 30000, "online_cloud_timeout_ms": 300000, "notify_cloud_delay_ms": 30000, "notify_default_delay_ms": 1500, "push_chat_period_ms": 60000, "push_chat_limit": 2, "saved_gifs_limit": 200, "edit_time_limit": 172800, "revoke_time_limit": 2147483647, "revoke_pm_time_limit": 2147483647, "rating_e_decay": 2419200, "stickers_recent_limit": 200, "stickers_faved_limit": 5, "channels_read_media_period": 604800, "pinned_dialogs_count_max": 5, "pinned_infolder_count_max": 100, "call_receive_timeout_ms": 20000, "call_ring_timeout_ms": 90000, "call_connect_timeout_ms": 30000, "call_packet_timeout_ms": 10000, "me_url_prefix": "https://t.me/", "gif_search_username": "gif", "venue_search_username": "foursquare", "img_search_username": "bing", "caption_length_max": 1024, "message_length_max": 4096, "webfile_dc_id": 4 } MTProto, 1031528421: Not fetching phone config MsgIdHandler64, 1031528421: WARNING: Given message id (6791479715347339265) is bigger than or equal to the current limit (6791479715347332097). Consider syncing your date. [09-Feb-2020 18:09:53 Europe/Helsinki] Enabled PHP logging MTProto, 1031528421: Starting update system API: MadelineProto is ready! AbstractAPIFactory, 1031528421: Finished init asynchronously AbstractAPIFactory: Didn't serialize in a while, doing that now... Files, 1031528421: Waiting for lock of file to download... Files, 1031528421: Got lock of file to download MsgIdHandler64, 1031528421: WARNING: Given message id (6791479723658967041) is bigger than or equal to the current limit (6791479723658945537). Consider syncing your date. Tools: Got the following exception within a forked strand started @ Loop:53, trying to rethrow Tools: danog\MadelineProto\TL\Exception: Length is too big
Revision: f899fc56e6add8256e034f0de99147023621e81a (AN UPDATE IS REQUIRED)
TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):



Loop.php(61): loop()

loopImpl()



Previous TL trace:



TL.php(970): deserialize()

TL.php(970): deserialize()

ReadLoop.php(221): deserialize()

readMessage()

Coroutine.php(116): send()

Placeholder.php(130): danog\MadelineProto{closure}()

Coroutine.php(127): resolve()

Placeholder.php(130): danog\MadelineProto{closure}()

Deferred.php(45): resolve()

ResourceInputStream.php(101): resolve()

NativeDriver.php(192): Amp\ByteStream{closure}()

NativeDriver.php(97): selectStreams()

Driver.php(134): dispatch()

Driver.php(72): tick()

Loop.php(84): run()

Tools.php(304): run()

AbstractAPIFactory.php(105): wait()

InternalDoc.php(4538): __call()

index.php(215): downloadToDir()

index.php(117): PARSEids()

Tools: Loop exceptionally stopped without resolving the promise Exception: Undefined variable: log in index.php:218 Exception: \danog\MadelineProto\Exception: Undefined variable: log in /var/www/html/a/index.php:218 Revision: f899fc56e6add8256e034f0de99147023621e81a (AN UPDATE IS REQUIRED) TL Trace:
index.php(218): exceptionErrorHandler()
index.php(117): PARSEids() MTProto, 1031528421: Shutting down MadelineProto (normally or due to an exception, idk) PeriodicLoop, 1031528421: Got signal in call check, exiting PeriodicLoop, 1031528421: Got signal in serialize, exiting PeriodicLoop, 1031528421: Got signal in phone config, exiting PeriodicLoop, 1031528421: Got signal in config, exiting PeriodicLoop, 1031528421: Got signal in TOS, exiting DataCenterConnection, 1031528421: Disconnecting from shared DC 2 Connection, 1031528421: Disconnecting from DC 2.0 DataCenterConnection, 1031528421: Backed up from DC 2.0 Connection, 1031528421: Disconnected from DC 2.0 DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC 2 DataCenterConnection, 1031528421: Disconnecting from shared DC 1 Connection, 1031528421: Disconnecting from DC 1.0 DataCenterConnection, 1031528421: Backed up from DC 1.0 Connection, 1031528421: Disconnected from DC 1.0 DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC 1 DataCenterConnection, 1031528421: Disconnecting from shared DC 2_media PeriodicLoop, 1031528421: Got signal in robin loop DC 2_media, exiting Connection, 1031528421: Disconnecting from DC 2_media.0 DataCenterConnection, 1031528421: Backed up upload.getFile, from DC 2_media.0 Connection, 1031528421: Disconnected from DC 2_media.0 Connection, 1031528421: Disconnecting from DC 2_media.1 DataCenterConnection, 1031528421: Backed up from DC 2_media.1 Connection, 1031528421: Disconnected from DC 2_media.1 Connection, 1031528421: Disconnecting from DC 2_media.2 DataCenterConnection, 1031528421: Backed up from DC 2_media.2 Connection, 1031528421: Disconnected from DC 2_media.2 Connection, 1031528421: Disconnecting from DC 2_media.3 DataCenterConnection, 1031528421: Backed up from DC 2_media.3 Connection, 1031528421: Disconnected from DC 2_media.3 Connection, 1031528421: Disconnecting from DC 2_media.4 DataCenterConnection, 1031528421: Backed up from DC 2_media.4 Connection, 1031528421: Disconnected from DC 2_media.4 DataCenterConnection, 1031528421: Backed up 1, added to 0 existing messages) from DC 2_media DataCenterConnection, 1031528421: Disconnecting from shared DC 3 Connection, 1031528421: Disconnecting from DC 3.0 DataCenterConnection, 1031528421: Backed up from DC 3.0 Connection, 1031528421: Disconnected from DC 3.0 DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC 3 DataCenterConnection, 1031528421: Disconnecting from shared DC 4 Connection, 1031528421: Disconnecting from DC 4.0 DataCenterConnection, 1031528421: Backed up from DC 4.0 Connection, 1031528421: Disconnected from DC 4.0 DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC 4 DataCenterConnection, 1031528421: Disconnecting from shared DC 4_media PeriodicLoop, 1031528421: Got signal in robin loop DC 4_media, exiting Connection, 1031528421: Disconnecting from DC 4_media.0 DataCenterConnection, 1031528421: Backed up from DC 4_media.0 Connection, 1031528421: Disconnected from DC 4_media.0 Connection, 1031528421: Disconnecting from DC 4_media.1 DataCenterConnection, 1031528421: Backed up from DC 4_media.1 Connection, 1031528421: Disconnected from DC 4_media.1 Connection, 1031528421: Disconnecting from DC 4_media.2 DataCenterConnection, 1031528421: Backed up from DC 4_media.2 Connection, 1031528421: Disconnected from DC 4_media.2 Connection, 1031528421: Disconnecting from DC 4_media.3 DataCenterConnection, 1031528421: Backed up from DC 4_media.3 Connection, 1031528421: Disconnected from DC 4_media.3 Connection, 1031528421: Disconnecting from DC 4_media.4 DataCenterConnection, 1031528421: Backed up from DC 4_media.4 Connection, 1031528421: Disconnected from DC 4_media.4 DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC 4_media DataCenterConnection, 1031528421: Disconnecting from shared DC 5 Connection, 1031528421: Disconnecting from DC 5.0 DataCenterConnection, 1031528421: Backed up from DC 5.0 Connection, 1031528421: Disconnected from DC 5.0 DataCenterConnection, 1031528421: Backed up 0, added to 0 existing messages) from DC 5 MTProto, 1031528421: Successfully destroyed MadelineProto `

sarelic commented 4 years ago
object(danog\MadelineProto\TL\Exception)#1694 (10) { ["message":protected]=> string(17) "Length is too big" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(97) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/TL/TL.php" ["line":protected]=> int(835) ["trace":"Exception":private]=> array(20) { [0]=> array(5) { ["file"]=> string(97) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/TL/TL.php" ["line"]=> int(970) ["function"]=> string(11) "deserialize" ["class"]=> string(25) "danog\MadelineProto\TL\TL" ["type"]=> string(2) "->" } [1]=> array(5) { ["file"]=> string(97) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/TL/TL.php" ["line"]=> int(970) ["function"]=> string(11) "deserialize" ["class"]=> string(25) "danog\MadelineProto\TL\TL" ["type"]=> string(2) "->" } [2]=> array(5) { ["file"]=> string(116) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Loop/Connection/ReadLoop.php" ["line"]=> int(221) ["function"]=> string(11) "deserialize" ["class"]=> string(25) "danog\MadelineProto\TL\TL" ["type"]=> string(2) "->" } [3]=> array(3) { ["function"]=> string(11) "readMessage" ["class"]=> string(44) "danog\MadelineProto\Loop\Connection\ReadLoop" ["type"]=> string(2) "->" } [4]=> array(5) { ["file"]=> string(101) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Coroutine.php" ["line"]=> int(116) ["function"]=> string(4) "send" ["class"]=> string(9) "Generator" ["type"]=> string(2) "->" } [5]=> array(5) { ["file"]=> string(82) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Internal/Placeholder.php" ["line"]=> int(130) ["function"]=> string(29) "danog\MadelineProto\{closure}" ["class"]=> string(29) "danog\MadelineProto\Coroutine" ["type"]=> string(2) "->" } [6]=> array(5) { ["file"]=> string(101) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Coroutine.php" ["line"]=> int(127) ["function"]=> string(7) "resolve" ["class"]=> string(29) "danog\MadelineProto\Coroutine" ["type"]=> string(2) "->" } [7]=> array(5) { ["file"]=> string(82) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Internal/Placeholder.php" ["line"]=> int(130) ["function"]=> string(29) "danog\MadelineProto\{closure}" ["class"]=> string(29) "danog\MadelineProto\Coroutine" ["type"]=> string(2) "->" } [8]=> array(5) { ["file"]=> string(70) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Deferred.php" ["line"]=> int(45) ["function"]=> string(7) "resolve" ["class"]=> string(92) "class@anonymousphar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Deferred.php:20$63" ["type"]=> string(2) "->" } [9]=> array(5) { ["file"]=> string(89) "phar:///var/www/html/a/madeline.phar/vendor/amphp/byte-stream/lib/ResourceInputStream.php" ["line"]=> int(101) ["function"]=> string(7) "resolve" ["class"]=> string(12) "Amp\Deferred" ["type"]=> string(2) "->" } [10]=> array(5) { ["file"]=> string(79) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/NativeDriver.php" ["line"]=> int(192) ["function"]=> string(24) "Amp\ByteStream\{closure}" ["class"]=> string(34) "Amp\ByteStream\ResourceInputStream" ["type"]=> string(2) "::" } [11]=> array(5) { ["file"]=> string(79) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/NativeDriver.php" ["line"]=> int(97) ["function"]=> string(13) "selectStreams" ["class"]=> string(21) "Amp\Loop\NativeDriver" ["type"]=> string(2) "->" } [12]=> array(5) { ["file"]=> string(73) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/Driver.php" ["line"]=> int(134) ["function"]=> string(8) "dispatch" ["class"]=> string(21) "Amp\Loop\NativeDriver" ["type"]=> string(2) "->" } [13]=> array(5) { ["file"]=> string(73) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop/Driver.php" ["line"]=> int(72) ["function"]=> string(4) "tick" ["class"]=> string(15) "Amp\Loop\Driver" ["type"]=> string(2) "->" } [14]=> array(5) { ["file"]=> string(66) "phar:///var/www/html/a/madeline.phar/vendor/amphp/amp/lib/Loop.php" ["line"]=> int(84) ["function"]=> string(3) "run" ["class"]=> string(15) "Amp\Loop\Driver" ["type"]=> string(2) "->" } [15]=> array(5) { ["file"]=> string(97) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/Tools.php" ["line"]=> int(304) ["function"]=> string(3) "run" ["class"]=> string(8) "Amp\Loop" ["type"]=> string(2) "::" } [16]=> array(5) { ["file"]=> string(110) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/AbstractAPIFactory.php" ["line"]=> int(105) ["function"]=> string(4) "wait" ["class"]=> string(25) "danog\MadelineProto\Tools" ["type"]=> string(2) "::" } [17]=> array(5) { ["file"]=> string(103) "phar:///var/www/html/a/madeline.phar/vendor/danog/madelineproto/src/danog/MadelineProto/InternalDoc.php" ["line"]=> int(4589) ["function"]=> string(6) "__call" ["class"]=> string(38) "danog\MadelineProto\AbstractAPIFactory" ["type"]=> string(2) "->" } [18]=> array(5) { ["file"]=> string(25) "/var/www/html/a/index.php" ["line"]=> int(220) ["function"]=> string(13) "downloadToDir" ["class"]=> string(31) "danog\MadelineProto\InternalDoc" ["type"]=> string(2) "->" } [19]=> array(3) { ["file"]=> string(25) "/var/www/html/a/index.php" ["line"]=> int(121) ["function"]=> string(8) "PARSEids" } } ["previous":"Exception":private]=> NULL ["tl_trace"]=> string(856) "
Loop.php(61): loop()
loopImpl()

Previous TL trace:

TL.php(970): deserialize()
TL.php(970): deserialize()
ReadLoop.php(221): deserialize()
readMessage()
Coroutine.php(116): send()
Placeholder.php(130): danog\MadelineProto\{closure}()
Coroutine.php(127): resolve()
Placeholder.php(130): danog\MadelineProto\{closure}()
Deferred.php(45): resolve()
ResourceInputStream.php(101): resolve()
NativeDriver.php(192): Amp\ByteStream\{closure}()
NativeDriver.php(97): selectStreams()
Driver.php(134): dispatch()
Driver.php(72): tick()
Loop.php(84): run()
Tools.php(304): run()
AbstractAPIFactory.php(105): wait()
InternalDoc.php(4589): __call()
index.php(220): downloadToDir()
index.php(121): PARSEids()" ["method":"danog\MadelineProto\TL\Exception":private]=> string(0) "" ["updated":"danog\MadelineProto\TL\Exception":private]=> bool(true) }
sarelic commented 4 years ago
danog\MadelineProto\TL\Exception: Length is too big
Revision: e4d56f32c25367e2f5eb38ca2071967e8c88d144 (AN UPDATE IS REQUIRED)
TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):

Loop.php(61): loop()

loopImpl()

Previous TL trace:

TL.php(970): deserialize()

TL.php(970): deserialize()

ReadLoop.php(221): deserialize()

readMessage()

Coroutine.php(116): send()

Placeholder.php(130): danog\MadelineProto\{closure}()

Coroutine.php(127): resolve()

Placeholder.php(130): danog\MadelineProto\{closure}()

Deferred.php(45): resolve()

ResourceInputStream.php(109): resolve()

Driver.php(116): Amp\ByteStream\{closure}()

Driver.php(72): tick()

Loop.php(84): run()

Tools.php(304): run()

AbstractAPIFactory.php(105): wait()

InternalDoc.php(4589): __call()

index.php(220): downloadToDir()
sarelic commented 4 years ago

Please check my code, your server) i test in 3 vds, and local server. All not working((

https://t.me/karaulny/195912

        $MadelineProto = new \danog\MadelineProto\API('session.madeline');
        $MadelineProto->start();
        $arrids = array();
    array_push($arrids, 195912);
    //$join = $MadelineProto->channels->joinChannel(['channel' => '@karaulny', ]);
    $messages_Messages = $MadelineProto->channels->getMessages(['channel' => '@karaulny', 'id' => $arrids, ]);
    print_r(json_encode($messages_Messages ));
    echo "</br></br><hr></br></br>";
    foreach($messages_Messages["messages"] as $arrmessage)
    {

        if($arrmessage["media"]["_"]=="messageMediaDocument")
        {
            echo "</br>messageMediaDocument</br>";
            try {
                    $info = $MadelineProto->getDownloadInfo($arrmessage["media"]);
                    //var_dump($info); //exit;
                    echo '</br>';
                    echo $info['ext'].' 1</br>';
                    echo $info['name'] .' 2</br>';
                    echo $info['mime'] .' 3</br>';
                    echo $info['size'] .' 4</br>';
                    $mediaurl = $MadelineProto->downloadToDir($arrmessage["media"], 'tmp/');
             } 
             catch (\danog\MadelineProto\TL\Exception $e) 
            {
                                echo $e;
                                echo 'TEST 1234'; exit;
            }
            finally
            {
                echo 'finally';
            }
            echo $mediaurl. 'GOOD';
        }
    }

response:


messageMediaDocument

.mp4 1
11_5328226355995740019 2
video/mp4 3
11462827 4
danog\MadelineProto\TL\Exception: Length is too big
Revision: e4d56f32c25367e2f5eb38ca2071967e8c88d144 (AN UPDATE IS REQUIRED)
TL Trace (YOU ABSOLUTELY MUST READ THE TEXT BELOW):

Loop.php(61): loop()

loopImpl()

Previous TL trace:

TL.php(970): deserialize()

TL.php(970): deserialize()

ReadLoop.php(221): deserialize()

readMessage()

Coroutine.php(116): send()

Placeholder.php(130): danog\MadelineProto\{closure}()

Coroutine.php(127): resolve()

Placeholder.php(130): danog\MadelineProto\{closure}()

Deferred.php(45): resolve()

ResourceInputStream.php(101): resolve()

NativeDriver.php(192): Amp\ByteStream\{closure}()

NativeDriver.php(97): selectStreams()

Driver.php(134): dispatch(true)

Driver.php(72): tick()

Loop.php(84): run()

Tools.php(304): run({})

AbstractAPIFactory.php(105): wait({})

InternalDoc.php(4589): __call("downloadToDir",[{"_":"messageMediaDocument","document":{"_":"document","id":5328226355995740019,"access_hash":2957327845024932018,"file_reference":{"_":"bytes","bytes":"AkB\/Ss0AAv1IXkDykH11uW82IGV8zTSjD4ZVRDo="},"date":1581100596,"mime_type":"video\/mp4","size":11462827,"thumbs":[{"_":"photoStrippedSize","type":"i","bytes":{"_":"bytes","bytes":"ARYorJALhQV2pjjk9fwqKW2aLbuI+boBUkThICxUn5uvpUMkhduc47DPSpGMZCvUY+tNAyasXEwmbIXt+VMWIlQ21sHgHHBoegERA7c0VP8AZ8vt5Bx3GKKXMgsXbdEe1QtnIH9aDZwHPB+uaKKsA+ywbNoDZ+tMWGJQADJx78UUUgHqkYbcC3480UUUrIA="}},{"_":"photoSize","type":"m","location":{"_":"fileLocationToBeDeprecated","volume_id":266216399,"local_id":34142},"w":320,"h":180,"size":14893}],"dc_id":2,"attributes":[{"_":"documentAttributeVideo","round_message":false,"supports_streaming":true,"duration":29,"w":1280,"h":720},{"_":"documentAttributeFilename","file_name":"11.mp4"}]}},"tmp\/",null,[]])

1.php(103): downloadToDir({"_":"messageMediaDocument","document":{"_":"document","id":5328226355995740019,"access_hash":2957327845024932018,"file_reference":{"_":"bytes","bytes":"AkB\/Ss0AAv1IXkDykH11uW82IGV8zTSjD4ZVRDo="},"date":1581100596,"mime_type":"video\/mp4","size":11462827,"thumbs":[{"_":"photoStrippedSize","type":"i","bytes":{"_":"bytes","bytes":"ARYorJALhQV2pjjk9fwqKW2aLbuI+boBUkThICxUn5uvpUMkhduc47DPSpGMZCvUY+tNAyasXEwmbIXt+VMWIlQ21sHgHHBoegERA7c0VP8AZ8vt5Bx3GKKXMgsXbdEe1QtnIH9aDZwHPB+uaKKsA+ywbNoDZ+tMWGJQADJx78UUUgHqkYbcC3480UUUrIA="}},{"_":"photoSize","type":"m","location":{"_":"fileLocationToBeDeprecated","volume_id":266216399,"local_id":34142},"w":320,"h":180,"size":14893}],"dc_id":2,"attributes":[{"_":"documentAttributeVideo","round_message":false,"supports_streaming":true,"duration":29,"w":1280,"h":720},{"_":"documentAttributeFilename","file_name":"11.mp4"}]}},"tmp\/")
danog commented 4 years ago

This is an issue with Telegram servers that was reported to the devs, try deleting the session and relogging in to fix.