I just want to mix around 10 rss feeds into one and then i want to filter the results as per my requirements.
I know we can use yahoo pipes like solution for this,but due to some reasons i do not want to use yahoo's facility so is their any open source solution which i can host on my server and mix feeds using it.
I am using PHP for development along with Javascript(jquery).
Can i do this using simplepie.
Yes, use SimplePie. set_feed_url() accepts an array, and will combine all of them for you automatically.
$feed = new SimplePie();
$feed->set_feed_url(array('your','urls','here'));
Related
I already made a simple RSS reader, but it only gets me like 25 articles. How do I make it to work like feedly.com or digg.com, so that it retrieves me many more feeds, and not only 25?
The php code I have:
$rss = simplexml_load_file('http://www.elespectador.com/rss.xml');
I already know how to retrieve the title, description, etc. of each item.
Pagination in feeds is arbitrary and you'll have trouble finding a consistent pattern. You should store any data so that now you have 25 elements, but when new ones are added, you keep adding more and more.
Another solution is to use the data from a service like Superfeedr (I created it!) which stores past content for milions of feeds.
I thought this would be fairly simple but it's proving challenging. Google uses https:// now and bing redirects to remove HTTP://.
How can I grab the top 5 URLs for a given search term?
I've tried several methods (including loading results into an iframe), but keep hitting brick walls with everything I try.
I wouldn't even need a proxy, as I'm talking about a very small amount results to be harvested, and will only use it for 20-30 terms once ever few months. Hardly enough to trigger whiplash from the search giants.
Any help would be much appreciated!
Here's one example of what I've tried:
$query = urlencode("test");
preg_match_all('/<a title=".*?" href=(.*?)>/', file_get_contents("http://www.bing.com/search?q=" . urlencode($query) ), $matches);
echo implode("<br>", $matches[1]);
There's three main ways to do this. Firstly, use the official API for the search engine you're using - Google has one, and most of them will. These are often volume limited, but for the numbers you're talking about, you'll be fine.
The second way is to use a scraper program to visit the search page, enter a search term, and submit the associated form. Since you've specified PHP, I'd recommend Goutte. Internally it uses Guzzle and Symfony Components, so it must be good! The README at the above link shows you how easy it is. Selection of HTML fragments is done using either XPath or CSS, so it is flexible too.
Lastly, given the low volume of required scrapes, consider downloading a free software package from Import.io. This lets you build a scraper using a point-and-click interface, and it learns how to scrape various areas of the page before storing the data in a local or cloud database.
You can also use a third party service like Serp Api to get Google results.
It should be pretty easy to integrate::
$query = [
"q" => "Coffee",
"google_domain" => "google.com",
];
$serp = new GoogleSearchResults();
$json_results = $serp.json($query);
GitHub project.
I'm attempting to build an RSS reader at the moment I'm using php's simplexml using
For example
$xml->item->title
But however this is dependent on the structure of the rss feed itself if the structure is different it won't work so I was wondering if theres a more broader and less specific way to grab all the titles from a RSS feed.
Thanks a lot
There is a RSS Specification document out there. You can find it at http://cyber.law.harvard.edu/rss/rss.html
Therefore, a RSS file always looks the same, but be carefull. There is always something like Atom.
You could use xPATH for searching within the RSS: http://nl.php.net/manual/en/simplexmlelement.xpath.php
maybe it´s an option for you using a contribution like this instead of invent the wheel again: http://www.phpclasses.org/package/3724-PHP-Parse-and-display-items-of-an-RSS-feed.html
You can use some Regex to filter the RSS files and split them into titles, etc. Whatever you want. As you will define which tags to grab data from.
Using something like: $regex = '/<(w+)[^>]*>(.*?)</\1>/s';
preg_match_all($reg_exp, $text, $match);
There are lot of feed formats. Writing code to comply all, is a bit difficult task. so..
I recommend using simple pie. http://simplepie.org/
or you can use google feed api also. here is a example using simple pie.
http://simplepie.org/wiki/setup/sample_page
How to join RSS feeds into one? (from php) what libs can help us with it?
You'll want to use SimpleXML
Either that, or you can use something like Yahoo! Pipes to merge them for you can create a merged RSS feed for you.
http://pipes.yahoo.com/pipes/
if you use pipes, be sure to filter by date, so you can get a feed with all the posts in chronological order. I've used it for a few things and it works great!
I have about 50 feeds (and growing) that I would like to filter before adding them to Google Reader. Each of the feeds will be filtered for the same keywords. If a keyword match is found, that item will be removed from the feed. Basically I'm just trying to eliminate some noise.
I know I can do this with Yahoo Pipes, but I'm looking for a self-hosted solution.
I'd like to pass a feed to a script on my server. That script will filter out unwanted feed items based on a list of defined keywords. The filtered feed will be the result. I plan to then add the feed to Google Reader.
(BTW, why doesn't Google Reader have filters like Gmail?)
Try using a RSS library like Simplepie. From there, writing the filter logic should be easy-peasy.
Try ReFilter. Looks nice.