NAME
RSS::From::Twitter - Convert Twitter page to RSS
VERSION
version 0.02
SYNOPSIS
# Use command-line scripts get-rss-from-twitter{,-list,-search,-user}
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DESCRIPTION
FUNCTIONS
None are exported by default, but they are exportable.
get_rss_from_twitter(%args) -> [status, msg, result, meta]
In June 2013, Twitter retired the RSS v1 API (e.g. http://search.twitter.com/search.rss?q=blah, etc). However, its replacement, the v1.1 API, is not as straightforward to use (e.g. needs auth). This function scrapes the Twitter search result page (e.g. https://twitter.com/search?q=blah) and converts it to RSS. I wrote this because I have other scripts expecting RSS input.
Expect breakage from time to time though, as scraping method is rather fragile.
Arguments ('*' denotes required arguments):
title => str
RSS title.
ua => obj
Supply a custom LWP::UserAgent object.
If supplied, will be used instead of the default LWP::UserAgent object.
url* => str
URL, e.g. https://twitter.com/foo or file:/test.html.
Return value:
Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
get_rss_from_twitter_list(%args) -> [status, msg, result, meta]
This function calls getrssfrom_twitter() with URL: https//twitter.com/USERNAME/LISTNAME
.
Arguments ('*' denotes required arguments):
listname* => str
User's list name.
ua => obj
Supply a custom LWP::UserAgent object.
If supplied, will be used instead of the default LWP::UserAgent object.
username* => str
Twitter username.
Return value:
Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
get_rss_from_twitter_search(%args) -> [status, msg, result, meta]
This function calls getrssfrom_twitter() with URL: https//twitter.com/search?q=QUERY
.
Arguments ('*' denotes required arguments):
query* => str
Search query.
ua => obj
Supply a custom LWP::UserAgent object.
If supplied, will be used instead of the default LWP::UserAgent object.
Return value:
Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
get_rss_from_twitter_user(%args) -> [status, msg, result, meta]
This function calls getrssfrom_twitter() with URL: https//twitter.com/USERNAME
.
Arguments ('*' denotes required arguments):
ua => obj
Supply a custom LWP::UserAgent object.
If supplied, will be used instead of the default LWP::UserAgent object.
username* => str
Twitter username.
Return value:
Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.