0

Hi Guys
i am working in a site say sample.com. which should have a search engine . this search engine should search videos from another site say sample2.com or youtube.com for example.

it will only show thumbnail, views rating etc of the fetched video. and when user will click on that thumbnail or video then it will take you to that corresponding site sample2.com and then play that video there.

Any idea or tutorial about how to do this?


Many Thanks in advance.

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by =OTS=G-Man
0

well it all depends on what the site you are searching is.

if it is YouTube they have API available to search and get all the info you need, other sites might have APIs as well.

here is youTubes PHP API reference http://code.google.com/apis/youtube/code.html#PHP

If the site doesn't have an API you could figure out there search URL and then parse the output for video info.

Edited by =OTS=G-Man: n/a

0

Thanks for the reply , i want to do it without using API. can you please let me know how to pass the url and where can i find the script which accepts the url of site from which we want to search videos?

Many thanks in advance.

0

Well, again it all depends on the site you want to search, but just run a search on there site and look at the URL (if its a GET query, POST you will have to dome a little digging).

YouTube for example looks like

http://www.youtube.com/results?search_query=cool+video&aq=f

so all you have to do is change cool+video with the term you want with URL encoding and read the return. Then you have to figure out a way to parse the HTML using some regular expressions and get the data you want.

or API

<?php
$query = $yt->newVideoQuery();
$query->setQuery($searchTerm);
$feed = $yt->getVideoFeed($query);

ListResults($feed);
?>
0

Great! you look like a super expert but i am just a learner :-(
So can you please provide some references of similar tutorials?


Thanks

0

Well to use API, i posted the link for YouTube, for other sites, best is to just google the sites name and API.

if you are looking for tutorials on the non API method, I haven't really looked for any. Best bet for that would be to look for some PHP RegEx tutorials on Google as well.

Heres a simple example that came up when searching php parse data from html - http://www.phpro.org/examples/Parse-HTML-With-PHP-And-DOM.html

Hope this helps you out

Edited by =OTS=G-Man: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.