I am working on ASP>Net site and my client wants when any user insert a youtube URL in his/her profile at that time my c# code or any JQuery Code or any youtube API code check this URL that it is exist on youtube.com or not. I have found many things but most of them give us string matcher or URL pattern checker code but my requirement is check this URL i.e. exist on youtube.com and this video is show for public video.
Can anyone help me out.....
Match pattern of URL against known pattern of YouTube video See Stack Overflow example
Use AJAX call to your server to screen scrape the entered URL and check for 404 header or typical text resulting in "The video you have requested is not available." using the HTML Agility pack for c#.
I can write this for you but it will cost you. :)
Related
We're successfully using the Youtube API to create a metadata-and-url xml feed that the GSA requires and pushing it to our Google Search Appliance according to the documentation
The question that we have is that we know you need to put a start url in the Content Sources > Web Crawl > Start and Block URLs page in the Admin Console. If we put in https://www.youtube.com as a start url and a follow pattern of https://www.youtube.com/watch?v=* (which all looks like all youtube videos follow) will the GSA only index whats coming from the feed or will it go out to youtube.com and index a bunch of content that isn't part of our channel? I don't see anywhere you can specify a channel for a video.
FYI, we are aware of FishBowlSolutions connector for YouTube but trying to avoid spinning up another server with TomCat just to index our YouTube videos.
You should not add the youtube-url to your Start URLs, only to your Follow Patterns. That way, the crawler will not crawl Youtube from top to bottom, but the URLs you provide in the feed will be crawled. However, if GSA finds URLs on the crawled pages, it will obviously also crawl those.
An option is to tighten the Follow Patterns. And of course you can develop a Youtube connector on Googles Adaptor Framework, which is not that hard for Java-developers!
Google CSE Search
YouTube User Panel
I haven't used GSA(I'm getting ramped up on it though, which is how I found your post), but the way I've accomplished this using Google's CSE is to index the channel, user or playlist specifically, vs. youtube in general, i.e.:
youtube dot com/user/alltrapmusic
or: youtube dot com/channel/UC_ahy2GUec7EmbWF3LGxLhQ
or: youtube dot com/playlist?list=PLsHnWFR4n5jBFYdsclaKtdWQtf2Iu8bKZ
So, in CSE, I can configure to search only that user, channel and playlist and return only results found on those three (Google CSE Search link).
I can only assume GSA works the same(as I mentioned, I have no experience with GSA); if not, my apologies.
~chipleh
p.s. - in order to find your youtube channel, go to the user link(YouTube User Panel link); there you'll find home, videos, playlists, channels, etc. Hope that helps.
For anyone else looking to use the Youtube api and push their videos to the GSA, we found that there needs to be a few changes to the feed.
The feedtype needs to be full in the xml.This tells the GSA that everything it needs to know about the content is in the xml and it doesn't need to go out and index a url.
You need to have a <content> node in the xml. We used the description coming from Youtube api as the value. This is what is displayed to the user in the search results
url attribute on the record needs to be a value that can be added to the Start and Block URL and Follow patterns in the GSA settings and it needs to be unique. These actually don't need to exist but the GSA will use this value in the xml to determine if it should be included in the index. We used a fake url and the value from Youtube video ID appended to make it unique
displayurl attribute will be the url that will be displayed in the results so it would have the actual youtube url.
Start and Block URLs should contain the general url attribute value. For us, it was the fake directory http://www.yourdomain.com/video/youtube/
Follow Pattern should contain the pattern to follow that also matches the Start URL. Since we only have videos in that directory, we're able to put the same value as the Start URL. If you are pointing to a real directory and have other content in that that you don't want to index, you may need to add whatever pattern is common to your videos.
A sample record is below. Once we updated our feed, added the Start and Block URLs, our videos appear in our search results.
<gsafeed>
<header>
<datasource>youtube</datasource>
<feedtype>full</feedtype>
</header>
<group action="add">
<record url="http://www.yourdomain.com/video/youtube/?VIDEOID" displayurl="https://www.youtube.com/watch?v=VIDEOID" mimetype="text/html">
<content><![CDATA[DESCRIPTION]]></content>
<metadata>
<meta name="Title" content="TITLE OF VIDEO"></meta>
<meta name="Published" content="2016-08-15T22:00:38.000Z"></meta>
<meta name="PhotoURL" content="https://i.ytimg.com/.."></meta>
</metadata>
</record>
</group>
</gsafeed>
In the new YouTube Google + comments system how can I retrieve comments that contain links.
For example if someone posts a link to another youtube video as follows:
http://www.youtube.com/watch?v=AZNHuFjnmUo
This gets converted to a link by the google plus system. The title of the video is shown as the text rather that the url. i.e. The html shown within the comments is this:
Francis HATES Google+
However the api for that comment only returns the title of the video which is pretty useless seeing as I want to get the link too. I am guessing that the system converts the url into an <a> tag which is stored in the database but then the api strips out the html when its requested so it only returns the videos title.
I have posted a defect here:
https://code.google.com/p/gdata-issues/issues/detail?id=5500
But that bug list seems to have very little activity going on in terms of responses to issues.
So is there another way to get the data I need?
What you can do while this bug remains is to extract the comment id and use it in the Google+ API with an activities.get request. This will return the full post with all links.
A bit cumbersome since it needs one request for each comment you want to check, but it seems to be the only way while the bug remains.
To take an example from the video you linked in the issue:
This YouTube comment returned by the API includes a YouTube link:
http://gdata.youtube.com/feeds/api/videos/rgkDKeSc-1o
/comments/z12hvvcgxznkufyo304ci1iqlnandzxjpes
You can use the z... ID in a request to the Google+ API:
https://developers.google.com/apis-explorer/#p/plus/v1/plus.activities.get?activityId=z12hvvcgxznkufyo304ci1iqlnandzxjpes
Which includes the full post including links.
My site is not able to show uploaded youtube videos when the url is a mobile (m.) site, but it works for the normal youtube site. It seems to me that the mobile and normal urls differ in a pattern, as shown below:
http://www.youtube.com/watch?v=5ILbPFSc4_4
http://m.youtube.com/#/watch?v=5ILbPFSc4_4&desktop_uri=%2Fwatch%3Fv%3D5ILbPFSc4_4
obviously, the m. is added, as is the /#, and all the &desktop_uri... stuff.
and again:
http://www.youtube.com/watch?v=8To-6VIJZRE
http://m.youtube.com/#/watch?v=9To-6VIJZRE&desktop_uri=%2Fwatch%3Fv%3D8To-6VIJZRE
What we hope to do is check to see if the url is mobile site, and if it is, parse it so it shows as the normal site.
Does any one know if all youtube urls work this way--if this similar pattern works for all the same videos on mobile and normal sites?
In general, any time you attempt to parse URLs for sites (as opposed to web APIs) by hand, you're leaving yourself open to breakage. There's no "contract" in place that states that a common format will always be used for watch page URLs on the mobile site, or on the desktop site.
The oEmbed service is what you should use whenever you want to take a YouTube watch page URL as input and get information about the underlying video resource as output in a programmatic fashion. That being said, the oEmbed response doesn't include a canonical link to the desktop YouTube watch page, so it's not going to give you exactly what you want in this case. For many use cases, such as when you want to get the embed code for a video given its watch page URL, it's the right choice.
If you do code something by hand, please ensure that your code is deployed somewhere where it would be easy to update if the format of the watch pages ever do change.
I have a rails app that I am looking into implementing videos. I know how embed the videos etc but I am confuse on how to do something like this.
I would like a user to have videos. When a users goes to add a video I want to give them the option of embedding a youtube video or a vimeo video(Should I write out if statement?) without having 2 completely different urls.
For example
If user embeded a youtube video url would look like this
mysite.com/videos/1/youtube/1
If a user were to add video it would look like this
mysite.com/videos/1/youtube/new
What I would like to implement is the user would go to video and then have the choice of choosing vimeo or youtube. Ater the user has input the url of the video and click create i would like urls to look like(whether its youtube, vimeo or uploaded from cpu)
mysite.com/videos/1
mysite.com/videos/new
What is the best way to approach this? Would it be nested resources then rewrite the url paths?
There are many solutions to this problem and I ended up using gem called oembed to handle processing of embedded files from youtube, vimeo etc.
figured this out forgot to update question. Check out solution here
Vaildate 1 field with mutiple options
From a RESTful perspective, the resource that you are requesting is the video. The mechanism of how that video is requested (whether that is Vimeo or Youtube) is irrelevant from the perspective of identifying the resource. The format of the video being requested is simply a parameter of the request. In your controller, you can decide how to render the video based on the parameters (or potentially other aspects of the request header). Your video should clearly exist as a resource as
mysite.com/videos/1
Let the parameters or the HTTP request dictate how that is rendered.
I googled a lot about how to make twitter media preview for my website entities if they are linked in a tweet like images below:
Any idea where can I find some documentation about it? Or a tutorial? Is this possible or these media/site previews are hardcoded in twitter?
EDIT:
so, what I need:
If someone links my site on twitter, my widget appear under the tweet, like below:
UPDATE 2012-06-13
It appears this is an Expanded Tweet - -what the requirements are to integrate these expansions into Twitter are do not appear to be displayed - but this sure is interesting.
Nope your in luck. They're not hardcoded into Twitter, they're available in the JSON response. You actually have in your post the word you need to google for entities.
You can add include_entities=1 to the end of most REST api calls and it will give you expanded information about the URL's contained within the JSON. It will split out all the URL's where you can parse out the Youtube links for example. The JSON also includes a special media_url entity but it only works for pictures. In any case, you can still parse out the media easily like youtube with a regex match because you get the URL's split out nicely with this include_entities=1 parameter.
example call :
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&include_entities=1
more documentation : https://dev.twitter.com/docs/tweet-entities
answer edited below based on clarification:
Editing Twitter itself with previews is impossible and it's also ineffective. 75% of traffic to Twitter happens outside of Twitter.com. However the most probable solution to achieving this request would be to download a browser extension.
This extension for example enbales previews of webpages directly in the users stream content preview pane on Twitter.com
https://chrome.google.com/webstore/detail/oijgblonhcagdhfbgjilnpjipmijimmn