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

twshoot doesn't trim the image. #58

Closed
TanukiMa opened this issue Mar 15, 2022 · 7 comments
Closed

twshoot doesn't trim the image. #58

TanukiMa opened this issue Mar 15, 2022 · 7 comments

Comments

@TanukiMa
Copy link

I am grateful to the developers.

By the way, twshoot doesn't trim the image.

Why?

$ ~/cancel-culture$ ./target/release/twshoot 1503631923154984960
$  $ file 1503631923154984960*.png
1503631923154984960-full.png: PNG image data, 800 x 4000, 8-bit/color RGBA, non-interlaced
1503631923154984960.png:      PNG image data, 596 x 3307, 8-bit/color RGBA, non-interlaced

1503631923154984960
1503631923154984960-full

@travisbrown
Copy link
Owner

Thanks for the report! Twitter has made some changes to the rendering that have broken the heuristics for finding the borders for the screenshot. I've been meaning to fix this but haven't gotten around to it. I'll take a look today.

@travisbrown
Copy link
Owner

@TanukiMa Mind trying this branch, from #59? It's not a perfect solution but it should work.

@TanukiMa
Copy link
Author

@TanukiMa Mind trying this branch, from #59? It's not a perfect solution but it should work.

Hi

$ uname -a
Linux lima-debian 5.16.0-4-amd64 #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08) x86_64 GNU/Linux
$ rustc -V ; cargo -V
rustc 1.57.0
cargo 1.56.0
$ git clone -b topic/twshoot-fix https://github.com/travisbrown/cancel-culture.git
$ cd cancel-culture
$ cargo b
$ export RUST_BACKTRACE=1
$ chromedriver --disable-dev-shm-usage &
$ ./target/debug/twshoot 1503631923154984960
thread 'main' panicked at 'attempt to subtract with overflow', /home/matanuki.linux/tmp/cancel-culture/src/browser/twitter/mod.rs:147:39
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.57.0/library/core/src/panicking.rs:100:14
   2: core::panicking::panic
             at /usr/src/rustc-1.57.0/library/core/src/panicking.rs:50:5
   3: cancel_culture::browser::twitter::crop_tweet::{{closure}}
             at ./src/browser/twitter/mod.rs:147:39
   4: core::option::Option<T>::and_then
             at /usr/src/rustc-1.57.0/library/core/src/option.rs:1055:24
   5: cancel_culture::browser::twitter::crop_tweet
             at ./src/browser/twitter/mod.rs:134:5
   6: twshoot::main::{{closure}}
             at ./src/bin/twshoot.rs:54:37
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /usr/src/rustc-1.57.0/library/core/src/future/mod.rs:80:19
   8: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:54
   9: tokio::coop::with_budget::{{closure}}
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  10: std::thread::local::LocalKey<T>::try_with
             at /usr/src/rustc-1.57.0/library/std/src/thread/local.rs:399:16
  11: std::thread::local::LocalKey<T>::with
             at /usr/src/rustc-1.57.0/library/std/src/thread/local.rs:375:9
  12: tokio::coop::with_budget
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  13: tokio::coop::budget
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  14: tokio::park::thread::CachedParkThread::block_on
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:31
  15: tokio::runtime::enter::Enter::block_on
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/enter.rs:151:13
  16: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/mod.rs:73:9
  17: tokio::runtime::Runtime::block_on
             at /home/matanuki.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:477:43
  18: twshoot::main
             at ./src/bin/twshoot.rs:21:5
  19: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.57.0/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
$ RUST_BACKTRACE=full ./target/debug/twshoot 1503631923154984960
thread 'main' panicked at 'attempt to subtract with overflow', /home/mguuji.linux/tmp/cancel-culture/src/browser/twitter/mod.rs:147:39
stack backtrace:
   0:     0x56121b013116 - std::backtrace_rs::backtrace::libunwind::trace::ha50a475b841b11d2
                               at /usr/src/rustc-1.57.0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x56121b013116 - std::backtrace_rs::backtrace::trace_unsynchronized::hddae4aceda2a719d
                               at /usr/src/rustc-1.57.0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x56121b013116 - std::sys_common::backtrace::_print_fmt::h1ab41869d175f41c
                               at /usr/src/rustc-1.57.0/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x56121b013116 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha2f2bffcbc2ca6c7
                               at /usr/src/rustc-1.57.0/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x56121b0447ec - core::fmt::write::hc9914525ef1910cf
                               at /usr/src/rustc-1.57.0/library/core/src/fmt/mod.rs:1163:17
   5:     0x56121b0035b5 - std::io::Write::write_fmt::h392025a69482f180
                               at /usr/src/rustc-1.57.0/library/std/src/io/mod.rs:1696:15
   6:     0x56121b005870 - std::sys_common::backtrace::_print::h60e738e57266592f
                               at /usr/src/rustc-1.57.0/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x56121b005870 - std::sys_common::backtrace::print::h9757d3a00cc1fe08
                               at /usr/src/rustc-1.57.0/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x56121b005870 - std::panicking::default_hook::{{closure}}::hb220e989c90fed09
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:210:50
   9:     0x56121b005411 - std::panicking::default_hook::h4fbaa8c1d6327269
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:227:9
  10:     0x56121b005e23 - std::panicking::rust_panic_with_hook::h4e697c6eb38a94c8
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:624:17
  11:     0x56121b013842 - std::panicking::begin_panic_handler::{{closure}}::h1d65387a554d4fe5
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:519:13
  12:     0x56121b013264 - std::sys_common::backtrace::__rust_end_short_backtrace::ha4fb48bf7ba61366
                               at /usr/src/rustc-1.57.0/library/std/src/sys_common/backtrace.rs:139:18
  13:     0x56121b005962 - rust_begin_unwind
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:517:5
  14:     0x56121a1021a1 - core::panicking::panic_fmt::hd44c1f426837a20d
                               at /usr/src/rustc-1.57.0/library/core/src/panicking.rs:100:14
  15:     0x56121a1020ed - core::panicking::panic::hed28a41c3268e81e
                               at /usr/src/rustc-1.57.0/library/core/src/panicking.rs:50:5
  16:     0x56121a1cdb38 - cancel_culture::browser::twitter::crop_tweet::{{closure}}::h4d0c7c34b614105d
                               at /home/mguuji.linux/tmp/cancel-culture/src/browser/twitter/mod.rs:147:39
  17:     0x56121a1862da - core::option::Option<T>::and_then::hcaf886291e7b80a7
                               at /usr/src/rustc-1.57.0/library/core/src/option.rs:1055:24
  18:     0x56121a1cd96e - cancel_culture::browser::twitter::crop_tweet::h66344e32a4756b20
                               at /home/mguuji.linux/tmp/cancel-culture/src/browser/twitter/mod.rs:134:5
  19:     0x56121a1bec6f - twshoot::main::{{closure}}::hd74ddac5ba03f5c0
                               at /home/mguuji.linux/tmp/cancel-culture/src/bin/twshoot.rs:54:37
  20:     0x56121a10fb9a - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h09ed4489c5a292f8
                               at /usr/src/rustc-1.57.0/library/core/src/future/mod.rs:80:19
  21:     0x56121a1b00bc - tokio::park::thread::CachedParkThread::block_on::{{closure}}::h18a7d6fc16be7138
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:54
  22:     0x56121a14b60a - tokio::coop::with_budget::{{closure}}::h4b85d86e0f06c17c
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  23:     0x56121a111ac8 - std::thread::local::LocalKey<T>::try_with::h1093365cfc0e7669
                               at /usr/src/rustc-1.57.0/library/std/src/thread/local.rs:399:16
  24:     0x56121a1119ab - std::thread::local::LocalKey<T>::with::hfa56b96940a2505c
                               at /usr/src/rustc-1.57.0/library/std/src/thread/local.rs:375:9
  25:     0x56121a1afa5d - tokio::coop::with_budget::h6f75d9f8e5f0f40c
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  26:     0x56121a1afa5d - tokio::coop::budget::hc69bf7d84fbde900
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  27:     0x56121a1afa5d - tokio::park::thread::CachedParkThread::block_on::h4ddb2da75b91ddc8
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:31
  28:     0x56121a171bbd - tokio::runtime::enter::Enter::block_on::h5cde5ff6501c625c
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/enter.rs:151:13
  29:     0x56121a1ad3f8 - tokio::runtime::thread_pool::ThreadPool::block_on::hb3138cc070ce452d
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/mod.rs:73:9
  30:     0x56121a155778 - tokio::runtime::Runtime::block_on::h31ee77cd8c555f4a
                               at /home/mguuji.linux/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:477:43
  31:     0x56121a16f7b7 - twshoot::main::hc84e2e886e4685d8
                               at /home/mguuji.linux/tmp/cancel-culture/src/bin/twshoot.rs:21:5
  32:     0x56121a14c69b - core::ops::function::FnOnce::call_once::h2cd5703e9314a2fd
                               at /usr/src/rustc-1.57.0/library/core/src/ops/function.rs:227:5
  33:     0x56121a1d604e - std::sys_common::backtrace::__rust_begin_short_backtrace::h3a13f1ef59c7645c
                               at /usr/src/rustc-1.57.0/library/std/src/sys_common/backtrace.rs:123:18
  34:     0x56121a1698f1 - std::rt::lang_start::{{closure}}::h50eb5b0e61c41dd7
                               at /usr/src/rustc-1.57.0/library/std/src/rt.rs:146:18
  35:     0x56121b001eb1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h023c878701de5c1e
                               at /usr/src/rustc-1.57.0/library/core/src/ops/function.rs:259:13
  36:     0x56121b001eb1 - std::panicking::try::do_call::he88ad8ae6a3d88ab
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:403:40
  37:     0x56121b001eb1 - std::panicking::try::h481413f88289ff9a
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:367:19
  38:     0x56121b001eb1 - std::panic::catch_unwind::h4a5f81b0226eeebd
                               at /usr/src/rustc-1.57.0/library/std/src/panic.rs:133:14
  39:     0x56121b001eb1 - std::rt::lang_start_internal::{{closure}}::h840c8a1c37696ff5
                               at /usr/src/rustc-1.57.0/library/std/src/rt.rs:128:48
  40:     0x56121b001eb1 - std::panicking::try::do_call::h4a61a6bd4baeb41c
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:403:40
  41:     0x56121b001eb1 - std::panicking::try::h04dd092bf6a73f6b
                               at /usr/src/rustc-1.57.0/library/std/src/panicking.rs:367:19
  42:     0x56121b001eb1 - std::panic::catch_unwind::hbbf6d0367845e3be
                               at /usr/src/rustc-1.57.0/library/std/src/panic.rs:133:14
  43:     0x56121b001eb1 - std::rt::lang_start_internal::h5088b51d14c801a3
                               at /usr/src/rustc-1.57.0/library/std/src/rt.rs:128:20
  44:     0x56121a1698c0 - std::rt::lang_start::ha3405040dba0c6bf
                               at /usr/src/rustc-1.57.0/library/std/src/rt.rs:145:17
  45:     0x56121a1711fc - main
  46:     0x7f2d44a987fd - __libc_start_main
  47:     0x56121a10275a - _start
  48:                0x0 - <unknown>

@travisbrown
Copy link
Owner

Okay, thanks, will take a look. Mind sharing the chromedriver version?

@TanukiMa
Copy link
Author

Okay, thanks, will take a look. Mind sharing the chromedriver version?

$ chromedriver --version
ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875})

@travisbrown
Copy link
Owner

Okay, I was able to reproduce the error and think it's fixed in the latest commit on that branch. Thanks for the detailed info.

@travisbrown
Copy link
Owner

Fixed (probably) in #59. If not please reopen.

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

No branches or pull requests

2 participants