Open kampiamodikuesto opened 6 years ago
seems that yahoo rss feed api have sometimes some problem to get the feed and output the json. We need to switch to another service like https://rss2json.com
please don't use at the same time:
template: "bower_components/template.html",
and
template_html: '....'
thanks for replay, i have to use rss2json.com services instead to insert direct feed url?
no, is an alternative o yahoo and must be implemented inside the social-feed core script.
i woul like to use your script to use with flicker rss. i have to edit your script and add a module to use rss2json output?
change RSS processor means rewrite completely the core script based on the new API. Is something that keep lot of time and need lot of testing
@HartLarsson Have there been any moves on this? I've been working on replacing yahoo with rss2json. So far so good, but I'm getting:
Uncaught TypeError: Cannot read property 'feed' of undefined
on this line:
$.each(json.responseData.feed.entries, function(index, element)
Even though the feeds are logging out properly in the console.
So far, I've been able to add the api key in the insert file and make a few changes to socialfeed.js:
`
rss : {
posts: [],
loaded: false,
api : 'https://api.rss2json.com/v1/api.json',
getData: function(url) {
var count = options.rss.limit,
limit = '&count='+ count,
key = '&api_key=' + options.rss.key,
url = '?rss_url=' + encodeURIComponent(url),
request_url = Feed.rss.api + url + key + limit + '&format=json&callback=?';
Utility.request(request_url, Feed.rss.utility.getPosts, Feed.rss.datatype);
},
utility: {
getPosts: function(json) {
console.log(json);
$.each(json.responseData.feed.entries, function(index, element) {
var post = new SocialFeedPost('rss', Feed.rss.utility.unifyPostData(index, element));
post.render();
});
},
unifyPostData: function(index, element){
var post = {};
post.id = index;
post.dt_create= moment(element.publishedDate, 'ddd, DD MMM YYYY HH:mm:ss ZZ', 'en');
post.author_link = '';
post.author_picture = '';
post.author_name = element.author;
post.message = Utility.stripHTML(element.title);
post.description = Utility.stripHTML(element.content);
post.social_network = 'rss';
post.link = element.link;
if (options.show_media && element.mediaGroups ) {
post.attachment = '<img class="attachment" src="' + element.mediaGroups[0].contents[0].url + '" />';
}
return post;
}
}
}
`
I am obviously missing something, but I am having trouble figuring out what it is.
I appreciate any help you can lend.
Thanks!
Also:
I have tried using:
getPosts: function(json) { console.log(json); if (json.query.count > 0 ){ $.each(json.query.results.feed, function(index, element) { var post = new SocialFeedPost('rss', Feed.rss.utility.unifyPostData(index, element)); post.render(); }); } },
and I get this error:
Uncaught TypeError: Cannot read property 'count' of undefined
at this line:
if (json.query.count > 0 ){
Very strange, the syntax is correct but you can try only with:
if (json.query.count) { // your code here }
Thank you for your reply!
I have made a few adjustments:
` rss : { posts: [], loaded: false, api : 'https://api.rss2json.com/v1/api.json',
getData: function(url) {
var counter = options.rss.limit,
limit = '&count='+ counter,
key = '&api_key=' + options.rss.key,
rssurl = '?rss_url=' + encodeURIComponent(url),
request_url = Feed.rss.api + rssurl + key + limit + '&format=json&callback=?';
Utility.request(request_url, Feed.rss.utility.getPosts);
},
utility: {
getPosts: function (json) {
console.log(json.status);
console.log(json.feed.title);
console.log(json.items.length);
console.log(json.feed);
console.log(json.query.count);
if(json.status == 'ok') {
$.each(json.items, function(index, element) {
var element = this;
var post = new SocialFeedPost('rss', Feed.rss.utility.unifyPostData(index, element));
post.render();
});
}
},
unifyPostData: function(index, element){
var post = {};
post.id = index;
post.dt_create= moment(element.publishedDate, 'ddd, DD MMM YYYY HH:mm:ss ZZ', 'en');
post.author_link = '';
post.author_picture = '';
post.author_name = element.author;
post.message = Utility.stripHTML(element.title);
post.description = Utility.stripHTML(element.content);
post.social_network = 'rss';
post.link = element.link;
if (options.show_media && element.mediaGroups ) {
post.attachment = '<img class="attachment" src="' + element.mediaGroups[0].contents[0].url + '" />';
}
return post; }
}
}
};
`
This kinda works, but not really.
console.log(json.status); console.log(json.feed.title); console.log(json.items.length); console.log(json.feed); console.log(json.query.count);
json.status = ok json.feed.title = my feed titles, all three of them json.items.length = 2 (picking this up from the insert.js) json.feed = displays feed info json.query.count = Uncaught TypeError: Cannot read property 'count' of undefined
It also is rotating between the three RSS feeds and showing only the 2 posts from one at load time.
Additionally, it simply says "Invalid Date" in the top right corner of the loaded posts.
Aside from this, the Twitter feed is loading and displaying properly.
I appreciate your help!
the script sometime works and sometime not, i have to reload many times the page to get some rss. This is my configuration:
when nothing is displayed/grapped form social, on the console i get an object with
why the rss server responde with 400? i try with different rss url but i get same behaver (sometime load rss some time no)
200 Server Response![](http://sm.uploads.im/t/doE4g.png)
400 Server Response![](http://sl.uploads.im/t/H8LzE.png)