How to extract the embedded/preview image from a link in C#? - c#

Im building a C# program that shows the news feed from a RSS XML page and I want to include a feature that shows a link, the title (Which I already have) and the image preview of that link like it happens on Discord, or Messenger.
If we send a link of a post, for example, and that post has a image, it will show a preview (+/- like the pictures). Same happens for Youtube links, it shows the tumbnail of the video.
Here is an example of a link from a post on Discord and Messenger.
It displays the "main picture" of that post.
Discord example: http://prntscr.com/n8j0m6
Messenger example: http://prntscr.com/n8j29f
I want to extract the embedded/preview image from a link in C# or at least the link of that image (So I can then load it in the program) or create a similar preview system. That would be even better. But with the image link, I can create a method to do that automatically.
I havent had any luck finding anything similar so far. Maybe I am not using the correct term.
Thank You in advance.

Related

Search Image in google

I need to search in google images for a photo and to take the first result and to put in picturebox.
The search is by a string that the user is picking.
please help.
I am Using c#
To hit the Google Image API from your c# code, you will need to perform an HTTP post request. I believe this post can show you how to format your request.
Also, it appears that the Google Image API is deprecated and will no longer work soon, according to this post.

Getting actual content from RSS feed

Here for example there is a link for ABC news which gives various RSS feeds to consume.
http://rss.cnn.com/rss/edition.rss`
Using this feeds in Windows 8 store app, I am able to read it using built in SyndicationClient class. However, it gives only title and few summary text for the news story/article and not all content. Now I want to have all content i.e. Text and Image. I saw many news reader app for Windows store and they are doing it pretty much easily when I tap on any story and it gives me actual content right there.
Any idea how to accomplish this? Do I need some sort of html parser here?
You can have a look at News, News Bento app for example. I want to achieve something similar.
Here are the images from the app:
This is extracted text and images from the news article:
This is the view when you click on "View Original Article". I know that view below is using webview control. But I want how to extract data like image above.
Well, answer is readablity. More here as well:
https://github.com/scottksmith95/CSharp.Readability
It took me lot of time to find out this stuff but it is exactly what I wanted.

how to get count of videos in a web page using code(by parsing it)

Does any one know how to check if the webpage has any videos or video links.
Like for example:
I am doing web automation for LG. Then i need all the video links(or Counts of video in a particular page).
This LG product link for product:GR-D907SL contains 12 Images, 1 Video and 0 Flash.
I am getting count for Images and flash. but how to get for videos?
Is there any way i can find there is a video?
I didnt find an answer for this so i did it using regular expresions
i identified using the
keywords like EMBEDDED, PLAYER
if there is any answer please let me know

Using Google for Image Search from a Mobile app

I'd like to implement the following: in a mobile app (Android, Windows Phone) the user takes a photo, and my app searches for such an image on the web. I was told that Google has something like that. I found a page about Google Image Search, but it is written that it is deprecated. It advises to use Custom Search instead, but I didn't find image search there (only text search).
My question is: does a solution for image searching from a mobile app exist?
google provide api for image search through keyword, you are looking for search through image ? may be this can of any help Google Search by Image API?
if you are looking for search by image tineye api is useful

Is it possible to embed Youtube/Vimeo videos in Markdown using a C# Markdown library

I'm writing a web app in .NET MVC4 and would like to use Markdown. I understand there are a few open source C# Markdown libraries, but I haven't found one that obviously supports embedding youtube or Vimeo videos inside Markdown text.
Does anyone know if it's possible?
The Solution using Standard Markdown ( not iFrame! )
Using an iframe is not the "obvious" solution... especially if the Markdown parser (or publishing platform) you are using does not support inlining content from a different website ... Instead you can "fake it" by including a valid linked-image in your Markdown file, using this format:
[![IMAGE ALT TEXT](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE "Video Title")
Explanation of the Markdown
If this markdown snippet looks complicated, break it down into two parts:
an image
![image alt text](http//example.io/link-to-image)
wrapped in a link
[link text](http//example.io/my-link "link title")
Example using Valid Markdown and YouTube Thumbnail:
We are sourcing the thumbnail image directly from YouTube and linking to the actual video, so when the person clicks the image/thumbnail they will be taken to the video.
Code:
[![Everything Is AWESOME](https://img.youtube.com/vi/StTqXEQ2l-Y/0.jpg)](https://www.youtube.com/watch?v=StTqXEQ2l-Y "Everything Is AWESOME")
OR If you want to give readers a visual cue that the image/thumbnail is actually a playable video, take your own screenshot of the video in YouTube and use that as the thumbnail instead.
Example using Screenshot with Video Controls as Visual Cue:
Code:
[![Everything Is AWESOME](http://i.imgur.com/Ot5DWAW.png)](https://youtu.be/StTqXEQ2l-Y?t=35s "Everything Is AWESOME")
 Clear Advantages
While this requires a couple of extra steps (a) taking the screenshot of the video and (b) uploading it so you can use the image as your thumbnail it does have 3 clear advantages:
The person reading your markdown (or resulting html page) has a visual cue telling them they can watch the video (video controls encourage clicking)
You can chose a specific frame in the video to use as the thumbnail (thus making your content more engaging)
You can link to a specific time in the video from which play will start when the linked-image is clicked. (in our case from 35 seconds)
Taking a screenshot takes a few seconds and there are keyboard shortcuts for each OS which copy the screenshot to your clipboard which means you can paste it for even faster upload.
Not Only C#
And since this is 100% Standard markdown, it works everywhere (not just for the C# parser!) ... try it on GitHub, Redit or Ghost!
Vimeo
This approach also works with Vimeo videos
Example
Code
[![Little red ridning hood](http://i.imgur.com/7YTMFQp.png)](https://vimeo.com/3514904 "Little red riding hood - Click to Watch!")
Notes:
How to take screenshot: http://www.take-a-screenshot.org/ (all platforms!)
Upload Thumbnail Image: Once you've taken your screenshot you can drag-and-drop it into imgur.com to upload and immediately use it as your thumbnail; couldn't be easier!
YouTube thumbnail info: How do I get a YouTube video thumbnail from the YouTube API?
Markdown format borrowed/modified/expanded from: Embed a YouTube video
You can use inline HTML to embed your video.
# this is a *markdown* document
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/watch?v=TheVideoID?autoplay=1" frameborder="0" allowfullscreen></iframe>
with a **youtube** video embedded
<iframe width="560" height="315" src="https://www.youtube.com/embed/-mUJnKI3ipI" frameborder="0" allowfullscreen></iframe>
Markdown won't let you embed videos, Basically the answers posted here are explaining to have a image link, which is clearly not what an embed means. So the answer to whether you can embed a video or not is "NO You can't".
You should be able to use the HTML5 <video> element. Someone tell me if this doesn't work.
(Just spotted this, many years late :-) , as I want to add video support to my md2pptx Markdown to PowerPoint open source tool.)
What about the syntax for embedding image, applied to other media?
![MyImage](https://example.com/image.png)
Oembed is interesting to make embedding easier: users just have to paste the URL instead of an iframe code.
For video, it could be
![MyVideo](http://www.youtube.com/watch?v=TheVideoID)

Categories