Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

hi !

I have a problem that has eaten my nerves

pls help me

problem:
i want to send photo by URL using "send_photo"

I have a list of links that I want to send but not all links are sent and I do not know what to do

Were there any restrictions on sending photos?

EX:

urls = ['https://www.quizazem.com/wp-content/uploads/2020/05/Levi-Ackerman-7.jpg', 'https://wallpaperboat.com/wp-content/uploads/2020/10/20/57360/levi-ackerman-11.jpg', 'https://pm1.narvii.com/7569/bb01b6be7f0cab4e25e4512859bd8a55ce944451r1-870-1011v2_hq.jpg', 'https://static.zerochan.net/Levi.Ackerman.full.2574308.png', 'https://comicvine1.cbsistatic.com/uploads/original/11119/111193741/4236626-2778572452-levi-.jpg', 'https://d.wattpad.com/story_parts/626306859/images/15509e0b21efe7a8149802357564.gif', 'https://www.bing.com/th/id/OGC.2a9355b4fe1871b4c0448bf2df5cf5ea?pid=1.7&rurl=https%3a%2f%2fd.wattpad.com%2fstory_parts%2f626306859%2fimages%2f15509e0b21efe7a8149802357564.gif&ehk=IM6fvrYF8PAe%2fgFzTs4eJX2%2bESIbhUckug8w2Culas4%3d', 'https://images.wallpapersden.com/image/download/levi-ackerman-attack-on-titan_a2poZWWUmZqaraWkpJRnZWltrWZmamc.jpg', 'https://yt3.ggpht.com/a/AGF-l79VdGJiPItRn3lszUx5sHGLBQtkCJFXSZ5w-A=s900-c-k-c0xffffffff-no-rj-mo', 'https://fsa.zobj.net/crop.php?r=CxMdr3P5rmLMLvc3HVN_kkjY5jEY2HwixIJJ1oRH1yFUAtt87mEdgXwM-D0KVFLKDAev-hZpIqMJ6pO2Gw-ZkFP-CnZ2nWIgu6Kj5PD9o_uo4QLkfqP4jHHrPxxD5KiXbJrlHf8WjtS6BhS0']


for url  in urls:
    context.bot.send_photo(update.effective_chat.id, url)

this my code and not all links are sent

🗡️

You must be logged in to vote

Replies: 4 comments · 3 replies

Comment options

Hi. Do you get any specific error message? If yes, please show the traceback.
In general, Telegram is sometimes a bit picky about URLs. In my experience links ending on a file ending work more reliable than links that don't.

You must be logged in to vote
0 replies
Comment options

Hi. Do you get any specific error message? If yes, please show the traceback.
In general, Telegram is sometimes a bit picky about URLs. In my experience links ending on a file ending work more reliable than links that don't.

no , nothing

i think it's just about telegram :(

You must be logged in to vote
3 replies
@Bibo-Joshi
Comment options

Do you have logging and/or an error handler enabled? Otherwise you probably just won't see the exception.
which of the images are sent, which arent?

@Poolitzer
Comment options

That sounds like you swallow the error somewhere, silently failing is really untypical.

Try raising telegram.error.BadRequest in the for loop and see if that shows up in your logging file.

@edimkeplin68
Comment options

you can try like this
context.bot.send_photo( "update.effective_chat.id, url");

Comment options

Hey,
Did you manage to fix your problem?
I’m facing the same issue when trying to send a photo via Telegram bot. It gives me this error:

BadRequest: Wrong type of the web page content

I’m using an image URL. Strangely, when I switch the image from JPG to PNG format, it works perfectly.
I’d really appreciate it if you could share how you solved this or any tips you have.

Thanks in advance!

You must be logged in to vote
0 replies

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
⁉️
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #2487 on April 25, 2021 17:05.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.