mmpx12 / twitter-media-downloader

twmd: CLI/GUI Apiless twitter downlaoder. Download medias from single tweet or a whole profile.
622 stars 71 forks source link

Can't type in password at all #40

Closed YRMMwasTaken closed 8 months ago

YRMMwasTaken commented 8 months ago

Trying to login to download NSFW content is impossible, because the password input doesn't react to my keystrokes at all. The only key that responds is Enter, but that just gives me a "Bad user/pass" message because the latter's empty. I'd be more understanding if a correct password didn't work, but being completely unable to type?

I'm using Windows 10, and tried vanilla Command Prompt and PowerShell; if I had to use something more specific, it wasn't really made clear enough and could be corrected. I'd appreciate any help you could give.

mmpx12 commented 8 months ago

@YRMMwasTaken Same as https://github.com/mmpx12/twitter-media-downloader/issues/34 But i'm not able to reproduce the issue. Its working fine for me on Linux and android (termux). I update the term package (which is used for asking password) maybe it will work now with v1.11.4. But If it's still not working, try to change:

--- a/twmd.go
+++ b/twmd.go
@@ -19,7 +19,6 @@ import (

    "github.com/mmpx12/optionparser"
    twitterscraper "github.com/n0madic/twitter-scraper"
-   "golang.org/x/term"
 )

 var (
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
@@ -200,20 +199,21 @@ func photoSingle(tweet *twitterscraper.Tweet, output string) {

 func askPass(twofa bool) {
    for {
-       var username string
+       var username, pass string
        fmt.Printf("username: ")
        fmt.Scanln(&username)
        fmt.Printf("password: ")
-       pass, _ := term.ReadPassword(int(os.Stdin.Fd()))
+       fmt.Scanln(&pass)
+       // pass, _ := term.ReadPassword(int(os.Stdin.Fd()))
        fmt.Println()
        if !twofa {
-           scraper.Login(username, string(pass))
+           scraper.Login(username, pass)
        } else {
            var code string
            fmt.Printf("two-factor: ")
            fmt.Scanln(&code)
            fmt.Println()
-           scraper.Login(username, string(pass), code)
+           scraper.Login(username, pass, code)
        }
        if !scraper.IsLoggedIn() {
            fmt.Println("Bad user/pass")
Lpaydat commented 8 months ago

This happen to me too. It works just fine until, not sure, may be session expired, and it ask me to login again. Then when provide username/password. I only got "Bad user/pass" result.

mmpx12 commented 8 months ago

@Lpaydat Is this still happen in last version (1.11.4)? Are you using winfows 10 too?

can you run this and check if its working:

main.go:

package main

import (
    "fmt"
    "os"
    "golang.org/x/term"
)

func main() {
    fmt.Printf("text (nothing will be print type text and press enter): ")
    txt, err := term.ReadPassword(int(os.Stdin.Fd()))
    if err != nil {
        panic(err)
    }
    fmt.Println()
    fmt.Println(string(txt))
}

go.mod:

module test

go 1.22.0

require golang.org/x/term v0.18.0

require golang.org/x/sys v0.18.0 // indirect

go.sum:

golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=

or run directly the bin: test.exe.zip

Lpaydat commented 8 months ago

@mmpx12 Yes, the code you provided is working. I use Manjaro Linux and the version is the 1.11.4 already, but the problem is still exist.

mmpx12 commented 8 months ago

@Lpaydat So your username or password arent correct or you have 2fa enable. Have you tried to connect on a web browser ?(maybe some captcha)

Lpaydat commented 8 months ago

@mmpx12 Sorry for delayed response. I didn't open my labtop for a while. I'm quite sure my username and password are correct because it works before it ask me to login again. And to be sure, I do reset the password and use the new password too, but it still show Bad user/pass.

Not sure is it because I use Google account to connect to platform or not. I successful logged in to web app using my Google account (and it didn't ask for password or captcha when I login this way).

mmpx12 commented 8 months ago

@Lpaydat you should use your username and not your email, but If its alrady the case, are you using 2fa or email confirmation? If not there is nothing i can do since im not able to reproduce this and the lib is use is now archived ...

Lpaydat commented 8 months ago

@mmpx12 You are very helpful. I managed to make it work. Thank you very much sir ❤️

mmpx12 commented 8 months ago

@Lpaydat Do what was the problem? What did you do to make it work?

Lpaydat commented 8 months ago

@mmpx12 I'm not very sure either. Perhaps I have two versions installed on my machine, each with a different path?

Initially, I registered a new email that was not bound to any social media, but it still didn't work, with the same error persisting. Later, I tried deleting twmd from /usr/bin/twmd and performed a fresh install. Then, I called twmd directly after re-installing, and it worked. However, if I call twmd from a directory other than the twitter-media-downloader itself, it still raises the same error.

So, I'm not sure, but maybe when I call it from a different directory, it uses a different binary?

mmpx12 commented 8 months ago

@Lpaydat strange ... I still cant reproduce it. Check ./twmd --verion (inside twitter-media-downloader directory) and twmd --version (in an other directory)

Lpaydat commented 8 months ago

@mmpx12 LoL, It's working now. I didn't do anything further, and I'm not sure why. Maybe there was something off with my machine. Thank you very much for your help, and I apologize for any trouble caused.