vysheng/tg

offset of history do not work with channels

RezaSR opened this issue · 12 comments

When set offset greater than 0 in history command of channels, it always returns the following error:
{"result": "FAIL", "error_code": 71, "error": "RPC_CALL_FAIL 400: OFFSET_INVALID"}

It works with super groups with no problem, but with channels it does not work at all.
(I tested this with the latest version of test branch)

Please help me.

I have same problem.

I solved it!
open queries.c file located in tgl directory.
find _tgl_do_get_history function and comment some lines as follows :

static void _tgl_do_get_history (struct tgl_state *TLS, struct get_history_extra *E, void (*callback)(struct tgl_state *TLS,void *callback_extra, int success, int size, struct tgl_message *list[]), void *callback_extra) {
  clear_packet ();
  //tgl_peer_t *C = tgl_peer_get (TLS, E->id);
  //if (tgl_get_peer_type (E->id) != TGL_PEER_CHANNEL || (C && (C->flags & TGLCHF_MEGAGROUP))) {
    out_int (CODE_messages_get_history);
    out_peer_id (TLS, E->id);
  //} else {    
  //  out_int (CODE_channels_get_important_history);

  //  out_int (CODE_input_channel);
  //  out_int (tgl_get_peer_id (E->id));
  //  out_long (E->id.access_hash);
  // }
  out_int (E->max_id);
  out_int (E->offset);
  out_int (E->limit);
  out_int (0);
  out_int (0);
  tglq_send_query (TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &get_history_methods, E, callback, callback_extra);
}

save and recompile and enjoy!

Thanks for ur help, I will try it.

@pishgaman-org Thanks a lot! It works!

hi
I can dumping message for channel but I can not dump all message or 1000 number of message, i can dump 50 number of message, are you have solution for dump increase messages?

thank you.
thank

@alisafari2017 So...this project is dead. There is a pretty nice python api for telegram https://github.com/LonamiWebs/Telethon. If you have some questions, write me @Goblenus (Telegram)

Not solved yet :(
telegram-history-dump.rb:51:in exec_tg_command': Telegram command failed: {"result"=>"FAIL", "error_code"=>71, "error"=>"RPC_CALL_FAIL 400: OFFSET_INVALID"} (RuntimeError)`

@yoossarian Do not use it! This project is dead!

@pishgaman-org Thank you sooo much, works like a charm.

@yoossarian Do not use it! This project is dead!

is ist? like, really?

Just used telethon, worked like a charm and easy to use. Download 2000+ worth of photos from 2017... The readthedocs is not easy to build the queries but I could manage with partial information from different sources.