b3nab / instapy-cli

:sparkles: Python library and CLI to upload photo and video on Instagram. W/o a phone!
MIT License
600 stars 98 forks source link

[BUG] Images are being uploaded without captions #62

Open gilbertohasnofb opened 5 years ago

gilbertohasnofb commented 5 years ago

Describe the bug Images are being uploaded without captions.

To Reproduce Happens every time.

from instapy_cli import client

user = input('username')
password = input('password')
text = 'test #foo #bar'

with client(username, password) as cli:
    cli.upload('./testfile.png', text)

Expected behavior Images with the text variable as caption on Instagram.

Env (please complete the following information):

gilbertohasnofb commented 5 years ago

It seems that using cli.upload('./testfile.png', caption=text) solves the problem. But the examples do not include the keyword caption for the second argument. Are the examples out of date?

Donearm commented 5 years ago

Doesn't for me. I'm using:

cli.upload(sys.argv[1], caption=text)

Where sys.argv[1] is a path to a file and text is a string built with an account I'm tagging first and a series of hashtags

OS: Archlinux Python: 3.7.4 Instapy-cli: 0.0.12

gilbertohasnofb commented 5 years ago

@Donearm so are you saying you don't get captions either way?

The caption I tested with in my project is:

    text = 'nine letters' + \
        '\r\n' + \
        '#9letters ' + \
        '#AlgorithmicArt ' + \
        '#GenerativeArt ' + \
        '#DigitalArt ' + \
        '#ComputerArt ' + \
        '#TextBasedArt ' + \
        '#TextArt ' + \
        '#BotArt ' + \
        '#ColourBlock ' + \
        '#Minimalism ' + \
        '#Minimal ' + \
        '#Helvetica ' + \
        '#Python ' + \
        '#Generative ' + \
        '#Digital ' + \
        '#Art ' + \
        '#ContemporaryArt ' + \
        '#Typography ' + \
        '#GraphicDesign'

and I am uploading images using:

with client(username, password) as cli:
        cli.upload('./output/output-' + str(image_index) + '.png',
                   caption=text,
                   )
Donearm commented 5 years ago

Yes, both using "caption=text" and just the text variable. The complete code to upload is:

with client(username, password) as cli:
    cli.upload(sys.argv[1], text)

An example caption would be:

@accountname •\r\n•\r\n•\r\n•\r\n•\r\n #hashtag1 #hashtag2 #hashtag3

And so on with the hashtags. Last week I had a similar issue where the hashtags and periods were being posted but not the accountname, nor the newlines were working (only the first one as per #45 ). Now the whole caption is absent

Donearm commented 5 years ago

Hadn't been trying for a few weeks but today it worked (same command as my last comment). I guess it was an issue on Instagram's side.