Twitter RSS Feeds

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
liquidblasted
Bear Rating Trainee
Bear Rating Trainee
Posts: 10
Joined: 24 Jun 2013, 12:16

Re: Twitter RSS Feeds

Postby liquidblasted » 25 Jun 2013, 08:19

jdelamater99 wrote:I just updated my script to v1.0!

Search support has been added.
your_URL_here/path_to_twitter_parser?q=foobar

Next up will be URL resolving, but I'm going on vacation at the end of the week, so, it will likely be a couple weeks before that's added.

https://github.com/jdelamater99/Twitter-RSS-Parser


Many thanx for adding search support!!! Excellent work!

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: Twitter RSS Feeds

Postby sleeper_service » 26 Jun 2013, 11:06

jdelamater99 wrote:I just updated my script to v1.0!

Search support has been added.
your_URL_here/path_to_twitter_parser?q=foobar

Next up will be URL resolving, but I'm going on vacation at the end of the week, so, it will likely be a couple weeks before that's added.

https://github.com/jdelamater99/Twitter-RSS-Parser


I'm currently having the following problem:

[Wed Jun 26 00:45:44 2013] [error] PHP Notice: Undefined variable: q in /var/apache2/2.2/htdocs/twitrss/config.php on line 151, referer: .../twitrss/?screen_name=Cmdr_Hadfield

I took a wild guess and added $q=NULL; in the search defaults section, to wit:

Code: Select all

//////////
// Search
if (!isset( $_GET["q"] )) {
  $search = false;
  $q = NULL;

jdelamater99
Bear Rating Master
Bear Rating Master
Posts: 109
Joined: 11 Apr 2013, 17:45

Re: Twitter RSS Feeds

Postby jdelamater99 » 26 Jun 2013, 15:48

Yup. I found the same thing, and that's the exact resolution that I used, and will be included in the next fix. Not sure why it didn't come up during testing though.

icc97
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 26 Jun 2013, 16:40

Re: Twitter RSS Feeds

Postby icc97 » 26 Jun 2013, 16:45

Just a post to say this is awesome. I have mine up and running at http://www.ianchanning.com/twitter-rss-parser/?home, worked perfectly. It took me a bit of time to figure out that the /?home option was what I was after. I think it might make things easier if you made your README.md URLs more understandable on github and begin with the /?home one

jdelamater99
Bear Rating Master
Bear Rating Master
Posts: 109
Joined: 11 Apr 2013, 17:45

Re: Twitter RSS Feeds

Postby jdelamater99 » 26 Jun 2013, 17:19

sleeper_service wrote:

Code: Select all

//////////
// Search
if (!isset( $_GET["q"] )) {
  $search = false;
  $q = NULL;


I went ahead and committed this update instead of waiting for the next release :D

icc97 wrote:Just a post to say this is awesome. I have mine up and running at http://www.ianchanning.com/twitter-rss-parser/?home, worked perfectly. It took me a bit of time to figure out that the /?home option was what I was after. I think it might make things easier if you made your README.md URLs more understandable on github and begin with the /?home one


Thanks for the feedback. I'll work on making it clearer what each of the different use cases are for.

icc97
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 26 Jun 2013, 16:40

Re: Twitter RSS Feeds

Postby icc97 » 26 Jun 2013, 17:56

@jdelamater99 I've put up a step-by-step guide to what I did to get this working on my site (http://ianchanning.wordpress.com/2013/0 ... rss-feeds/). I also forked your github repo to make the README.md changes I was trying to suggest.

craywolf
Mr. Awesome
Posts: 97
Joined: 19 Mar 2013, 18:07

Re: Twitter RSS Feeds

Postby craywolf » 26 Jun 2013, 19:48

Hey this script is looking good, but I can't seem to search for hashtags or do multiple-word searches:

What the blank results look like:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="atom-to-html.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Search: amazon free</title>
</feed>
<!-- vim:ft=xml -->


These searches do return results on twitter.com - https://twitter.com/search?q=amazon%20free

I'm not actually trying to set up this search (or any search for that matter, I just noticed this while checking out the script), but it's the same regardless of keywords used.

jdelamater99
Bear Rating Master
Bear Rating Master
Posts: 109
Joined: 11 Apr 2013, 17:45

Re: Twitter RSS Feeds

Postby jdelamater99 » 26 Jun 2013, 20:06

Thanks, I'll look into that. If i had to guess, I'd guess that the input sanitization is the cause of this.

.:edit:. nope, not that.

.:edit2:.
FYI, this doesn't seem to work, at least not for me.
https://twitter.com/search?q=#amazon

nm, changine # to %23 works.

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: Twitter RSS Feeds

Postby sleeper_service » 26 Jun 2013, 22:58

jdelamater99 wrote:Yup. I found the same thing, and that's the exact resolution that I used, and will be included in the next fix. Not sure why it didn't come up during testing though.

I'm guessing that those people that wanted searching didn't see it cuz q was set to something, and the rest of us weren't scouring our error logs like we shoulda... ;)

(I won't mention that I just did an update and didn't add all the extra new settings in the updated config file to my local one, and my error log was absolutely *FULL* of complaints about missing variables...., no, I won't mention that at all)

craywolf
Mr. Awesome
Posts: 97
Joined: 19 Mar 2013, 18:07

Re: Twitter RSS Feeds

Postby craywolf » 26 Jun 2013, 23:58

I've made a few changes within user.php to get the output to pass the validator at http://validator.w3.org/feed/

The header output now has (valid, I think) <link>, <id>, and <updated> elements, each entry has the correct format for <updated> now, and extraneous HTML has been removed from <content> tags.

The <updated> element is taken from the time stamp of the first (most recent) tweet, since that seems like a reasonable thing to do. The alternative is to just make it "date('c')" which will return the current time when the output is generated, which is less honest but still reasonable.

Here's the diff:

Code: Select all

22a23,24
> print('<link href="http://twitter.com/'.$twitter_data[0]['user']['screen_name'].'" />'. PHP_EOL);
> print('<id>tag:twitter.com,2006:'.$twitter_data[0]['user']['id_str'].'</id>'. PHP_EOL);
23a26
> print('<updated>'.date('c', strtotime($twitter_data[0]['created_at'])).'</updated>'. PHP_EOL);
33c36
<               $feedContent = '                <content type="html"><![CDATA[<html><body><p></p><p>'.$twitter_data[$i]['text'].'</p></body></html>]]></content>';
---
>               $feedContent = '                <content type="html"><![CDATA[<p>'.$twitter_data[$i]['text'].'</p>]]></content>';
37c40
<               print('         <updated>'.$twitter_data[$i]['created_at'].'</updated>'. PHP_EOL);
---
>               print('         <updated>'.date('c', strtotime($twitter_data[$i]['created_at'])).'</updated>'. PHP_EOL);


With those changes, the output of user.php validates, but there are still two recommendations. One is that there should be a <link rel="self"> element pointing to the feed URL, but PHP doesn't make it easy to construct that URL, and it's only a recommendation so I left it alone.

The other recommendation is that each entry's <author> shouldn't be blank. I looked into fixing that, but couldn't figure out how to get retweets to show the original tweeter as the author.

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: Twitter RSS Feeds

Postby sleeper_service » 27 Jun 2013, 00:02

craywolf wrote:Hey this script is looking good, but I can't seem to search for hashtags or do multiple-word searches:


These searches do return results on twitter.com - https://twitter.com/search?q=amazon%20free

I'm not actually trying to set up this search (or any search for that matter, I just noticed this while checking out the script), but it's the same regardless of keywords used.


what's the point/benefit of doing searches via the script, instead of directly from twitter? (pretend I've been asleep and missed the revelation of the awesomeness of it)

craywolf
Mr. Awesome
Posts: 97
Joined: 19 Mar 2013, 18:07

Re: Twitter RSS Feeds

Postby craywolf » 27 Jun 2013, 00:06

sleeper_service wrote:what's the point/benefit of doing searches via the script, instead of directly from twitter? (pretend I've been asleep and missed the revelation of the awesomeness of it)


What's the benefit of using RSS instead of going to the website for anything?

Honestly I'm not even using the search functionality of this script, I just noticed that there was this problem with it. I do use tt-rss for several craigslist searches though. So that I don't have to constantly go to craigslist.org and run searches. New results just show up for me.

It would be the same with twitter, if there were any twitter search I felt I needed to be constantly up-to-date on.

jdelamater99
Bear Rating Master
Bear Rating Master
Posts: 109
Joined: 11 Apr 2013, 17:45

Re: Twitter RSS Feeds

Postby jdelamater99 » 27 Jun 2013, 00:32

craywolf wrote:I've made a few changes within user.php to get the output to pass the validator at http://validator.w3.org/feed/


I've been testing the output with the w3 validator since v.5, and all my tests have been valid/well-formed XML from that point on.

Also, those differences are next to impossible to read :)

craywolf
Mr. Awesome
Posts: 97
Joined: 19 Mar 2013, 18:07

Re: Twitter RSS Feeds

Postby craywolf » 27 Jun 2013, 00:45

jdelamater99 wrote:I've been testing the output with the w3 validator since v.5, and all my tests have been valid/well-formed XML from that point on.


Then there is something wildly different between the script you're running, and the script I'm running. I replaced my altered script with the one from your github repo, pasted the output of http://mydomain.tld/twitter-to-rss/?screen_name=wilw into the validator, and here's what it has to say:

Sorry

This feed does not validate.
line 3, column 0: Missing feed element: id [help]
<feed xmlns="http://www.w3.org/2005/Atom">
line 3, column 0: Missing feed element: updated [help]
<feed xmlns="http://www.w3.org/2005/Atom">
line 12, column 41: updated must be an RFC-3339 date-time: Wed Jun 26 20:29:50 +0000 2013 (20 occurrences) [help]
<updated>Wed Jun 26 20:29:50 +0000 2013</updated>


That can't just be a difference in PHP version or something, unless your PHP randomly inserts valid <id> and <updated> tags into output.

Also, those differences are next to impossible to read :)


The first three lines starting with ">" were added to the header output under the <feed> tag (line 23). The $feedContent line (#33 in the original) starting with "<" was removed from the file, and replaced with the line below it. The "print('..." line (#37 in the original) starting with "<" was removed from the file, and replaced with the line below it.

If you prefer I'll send you a pull request, once we figure out why you and I are apparently getting very different output.

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: Twitter RSS Feeds

Postby sleeper_service » 27 Jun 2013, 01:00

craywolf wrote:
sleeper_service wrote:what's the point/benefit of doing searches via the script, instead of directly from twitter? (pretend I've been asleep and missed the revelation of the awesomeness of it)


What's the benefit of using RSS instead of going to the website for anything?

Honestly I'm not even using the search functionality of this script, I just noticed that there was this problem with it. I do use tt-rss for several craigslist searches though. So that I don't have to constantly go to craigslist.org and run searches. New results just show up for me.

It would be the same with twitter, if there were any twitter search I felt I needed to be constantly up-to-date on.

ah, ok, I hadn't done any twitter searches, I mistakenly thought you were doing a search for twittering feeds, not searching for mentiones of things on any feed... nevermind me, I'm going back to bed... ;)

(I do the craigslist search thing via rss too)


Return to “Support”

Who is online

Users browsing this forum: No registered users and 8 guests