-
Notifications
You must be signed in to change notification settings - Fork 46
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
How can I upload images to telegraph via this library? #3
Comments
It's not possible to upload photos/videos via API, but you can use this code
|
Thank you very very very much :) |
how to use this in php?
|
@f126ck Could you, please, share your code? |
@python273 Could you tell me, please, what would I change in order to make the post with picture? I used your code for example. I will be waiting for your response. Thank you! from telegraph import Telegraph
telegraph = Telegraph()
telegraph.create_account(short_name='1337')
response = telegraph.create_page(
'Hey',
html_content='<p>Hello, world!</p>'
)
with open('/Users/deantipin/picture.png', 'rb') as f:
print(
requests.post(
'http://telegra.ph/upload',
files={'Hey': ('Hey', f, 'image/png')} # image/gif, image/jpeg, image/jpg, image/png, video/mp4
).json()
)
print('http://telegra.ph/{}'.format(response['path'])) |
@deantipin maybe i'm late, but it should work from telegraph import Telegraph
telegraph = Telegraph()
telegraph.create_account(short_name='1337')
with open('/Users/deantipin/picture.png', 'rb') as f:
path = requests.post(
'https://telegra.ph/upload', files={'file':
('file', f,
'image/jpeg')}).json()[0]['src']
response = telegraph.create_page(
'Hey',
html_content="<p>Hello, world!</p> \
<img src='{}'/>".format(path),
)
print('http://telegra.ph/{}'.format(response['path'])) |
Hello! Guys its possible posting to telegra.ph but from url via node js? |
@greatspoke you can download the picture and upload to telegraph |
Hey guys |
I mean use with https://www.npmjs.com/package/telegraph-node
But not work((( |
Using http I'm getting: response [200] with What I'm doing wrong? |
Hello, @python273! Have been trying to upload an image both via
No googling of the issue helped so far. :( Please, can anything be done about it ? |
Seems like
Maybe |
I face this issue: #36 Does anyone here face this? I do the same code that mentions this issue, it works fine for image but error for video/mp4. |
@goodeejay |
Noob here.
I wanted to know if it was possible to make a telegraph article including photos/videos which I have got on my hard disk.
How can I upload them and show in the article?
Thanks
The text was updated successfully, but these errors were encountered: