I'm writing a telegram bot but I have a question.
For now my bot will search for an image based on user request, but if I the bat found more than one image I want to send to the user a list of image with a link for search that iamge.
Eg.
/command mickey mouse
.... image 1....
I found more than one image, please be more specific
[link to image 2]
[link to image 3]
If the user will click the link I need to autosend message with the command and the name of the new image.
Is possible? I tried to add an hyperlink to the telegram api but i will open in the browser and send me a json with call status of the api.
For inline mode you can simply return a list of image results that will be displayed as kind of a popup on top of keyboard.
For conversation mode you have options:
1) Return images as inline keyboard attachment to a message with array of buttons each having callback_data parameter or switch_inline_query_current_chat or url parameter. Handle one of this to display the image.
2) Return message text as HTML with list of links in form of: image name
Then you can parse the start command and extract image ID. This has disadvantage that user would need to click the "START" button every time after he clicked the link.
You can use the 2nd approach with inline mode as well.
In my #DebtsTrackerBot I use both callbacks & switch_inline_query_current_chat for similar task.
We can vote the suggestion for TelegramBotApi: https://bugs.telegram.org/c/3901
Related
I selected text and made that text link using "ep_embedded_hyperlinks2". Now I want to get all content that is in pad. Trying with /pads/getHTML api.
This returns all text but no link/url which I made. Is there any way I can get that link/anchor along with all content from etherpad.
https://i.stack.imgur.com/ZapWn.png
Thanks in advance
Want to automate twitter's sending images button so I can send a file with python using selenium with the send_Keys method, but can't find its id or name nor class. This is all the code that appears referent to the button:
Html twitter send images button
Note: None of the classes shown above have worked for me
You can try to use x-path, I'm using a chrome extension: https://chrome.google.com/webstore/detail/xpath-finder/ihnknokegkbpmofmafnkoadfjkhlogph?hl=en
To locate the element you want to click.
And then you can use driver.find_element_by_xpath("X-PATH").click()
How can I show an html anchor tag in
Office.context.mailbox.item.notificationMessages.addAsync method for "error" key? I have a scenario where user should be able to click on a link from this error message and navigate to a different page.
I tried embedding elements as it's display the 'Dismiss' hyperlink right next to these error message by default. However, this displays these tags as it is.
Please help.
Unfortunately, this capability is not supported for notification messages. They cannot display HTML content and will not honor anchor tags.
I have used python scrapy to extract data from a website. Now i am able to scrape most of the details of a site using scrapy. But my main problem is that iam not able to extract all the reviews of products from the site. I am only able to extract the top 4 reviews which they display on the page and for getting other reviews i have to go to a pop up window which has all the reviews. I looked for 'href' for the popup window but im not able to find it. This is the link that i tried to scrape. The reviews and ratings are at the bottom of the page: https://www.coursera.org/learn/big-data-introduction
Can any one help me by explaining how to extract the reviews from this popup window. Another think to note is that there is infinite scrolling for the pop up.
Thanks in advance.
Scrapy, unlike tools like Selenium and PhantomJS, does not drive a full web browser in the background. You cannot just click a button.
You need to understand what the button does (e.g. does it simply submit a form? Does it do something with JavaScript? Etc.) and reproduce the functionality in your own code.
For example, you might need to read the content of a script element, apply regular expressions to it to pull a URL from a string literal, then make a new HTTP request to that URL, the pell the data you want from the new DOM.
... and then repeat for the next “page” of the infinite scroll.
I have the following variable appended to 'QTextBrowser'. It does appear as a link, but when I click on it all the text in the 'QTextBrowser' disappears. All the function the 'anchorClicked' signal is connected to does is print something in the shell so that I know that the signal was received.
word = '<a href>' + '<span style="background-color:#C0C0C0">' + word + '</span>' +'</a>'
self.textBrowser.anchorClicked.connect(self.test)
def test(self,argv_1):
print('!!!')
Probably what's happening is that the text browser is attempting navigate to the href specified in the anchor. But since the href is empty, it just shows a blank page.
If you want to stop automatic link navigation, try this:
self.textBrowser.setOpenLinks(False)
(NB: the anchorClicked signal will still be sent when the link is clicked).
You can also prevent this behaviour by calling self.textBrowser.setSource(QtCore.QUrl()) in the function connected to the anchorClicked signal (in your case test()).
For an example, see what I did in my answer to your other question here: https://stackoverflow.com/a/19475367/1994235
This allows you to still have some links that take you to other pages, and some that don't (you call the above line of code to prevent the page change, only when certain urls are passed to your function)
Use html2text to download the URL to matching directory for every link on the page. Reformat as HTML, adding headers and rewiring the links. Then do this recursively every time you click on a link and you effectively have a working web browser. The links will actually work. I would like to see someone do it in less than 3 pages if they can.