Telegram API trouble with article Python - python

Good day, how i can upload image/photo on method answerInlineQuery in parameter 'article'? how it' work on #imdb bot:
Because when i send image in parameter 'message_text' it's not always loaded.

That image from your example was grabbed from the link included in message.
You can set parse_mode=HTML and make a link to your image around unbreakable space like this:

Related

Can I change the purpose of a Python bot (from MoviePy)?

I wish to add this effects in MoviePy:
clip = clip.fx( vfx.colorx, 2.5) clips.append(clip)
to a local already-edited video instead of pulling the video from the internet.
Applying the effects will make the video unique to get around YouTube’s Content ID.
Here is where I learnt about this method: https://youtu.be/AGD-alltz6g
I removed the YouTube links from the code the YouTube guy wrote and added the local file path (“C:\Users\My PC\Videos\Video Name”) of my preferred video, but nothing worked.
Could you help me, please?

Getting an image of a custom Discord embed

I need to programmatically get an image of a Discord embed. Here is an example of the kind of embed I mean.
I want to get an image like that without having to take a screenshot of the application myself. I'm hoping there's an easy way to get them, otherwise I may have to generate the images myself. I'm using discord.py.
You can use Message.embeds, then get the embed.image.url from the returned list.
For example, if you have a message object, my_message, you can do the following:
image_url = my_message.embeds[0].image.url
(This is assuming you've already got the message object. You can do this a number of ways, e.g. in your on_message event.)

How to download a specific number of photos (not the entire post) using instaloader

I'm using an api for instagram called instaloader. I'm trying to download 25 pictures from each profile in an array. I tried using get_posts
for post in profile.get_posts():
#download posts
L.download_post(post, target=data_path/p_name)
but this downloads the picture along with all the comments and metadata. I only want to download the pictures because the instagram accounts I'm scraping have too many comments (getting comments isn't the point anyway).
I saw something called download_pic but I have no idea how to use it. I tried using it in my code below and got an error that said "url is not defined".
profile_names = ["kyliejenner", "justinbieber", "instagram"]
for p_name in profile_names:
profile = Profile.from_username(L.context, p_name)
L.download_pic(data_path/p_name, url, mtime, filename_suffix=None, _attempt=1)
Could someone explain to me how to use download_pic (if that's what I'm supposed to be using to only download photo's/videos) and maybe send me to a reliable tutorial?
I was looking for exacly the same thing for some time and I finally found solution:
L.download_pic(FILENAME, POST.url, POST.date_utc)
POST object you can get using e.g. Post.from_shortcode()
POST.url will give you the link for first image in post
POST.date_utc will just grab the date and time from the post (without mtime entered you are not able to download it)
This will download just the picture into folder you want to.

Can I send images back to API.AI?

I've been working on something using API.AI to create a Google Action that will send random web comics when asked. I have tried and tried, but so far it doesn't seem like there is a good way to put the image's bytes into the JSON response required for API.AI. I might have missed something along the way, but if anyone knows how this can be accomplished that would be of great help. I have been using python if that helps.
You can get or put images as a response from Api.ai just put url of that image . Here is some useful docs link :
https://docs.api.ai/docs/rich-messages#image
https://docs.api.ai/docs/query#section-message-objects

Streaming audio (YouTube)

I'm writing a CLI for a music-media-platform. One of the features is going to be that you can directly play YouTube videos from the CLI. I don't really have an idea of how to do it, but this one sounded the most reasonable:
I'm going to use of those sites where you can download music from YouTube, for example, http://keepvid.com/ and then I directly stream and play this, but I have one problem. Is there any Python library capable of doing this and if so, do you have any concrete examples?
I've been looking, but I found nothing, even not with GStreamer.
You need two things to be able to download a YouTube video, the video id, which is represented by the v= section of the URL, and a hidden field t= which is present in the page source. I have no idea what this t value is, but it's what you need :)
You can then download the video using a URL in the format;
http://www.youtube.com/get_video?video_id=*******&t=*******
Where the stars represent the values obtained.
I'm guessing you can ask for the video id from user input, as it's straightforward to obtain. Your program would then download the HTML source for that video, parse the source for the t value, then download the video using the newly constructed URL.
For example, if you open this link in your browser, it should download the video, or you can use a downloading program such as Wget;
http://www.youtube.com/get_video?video_id=3HrSN7176XI&t=vjVQa1PpcFNM4c8MbEhsnGaNvYKoYERIJ-hK7ErLpUI=
It appears that KeepVid is simply a JavaScript bookmarklet that links you to a KeepVid download page where you can then download the YouTube video in any one of a variety of formats. So, unless you want to figure out how to stream the file that it links you to, it's not easily doable. You'd have to scrape the page returned and figure out which URL you wanted to download, and then you'd have to stream from that URL (and some of the formats may or may not be streamable anyway).
And as an aside, even though they don't have a terms of service specified, I'd imagine that since they appear to be mostly advertisement-supported that abusing their functionality by going around their advertisement-supported webpage would be ethically questionable.

Categories

Resources