BusyBird

 view release on metacpan or  search on metacpan

lib/BusyBird/Filter/Twitter.pm  view on Meta::CPAN

Add BusyBird-specific fields to the statuses.

=item *

Normalize status objects from Search API v1.0.

=item *

HTML-unescape text content so that L<BusyBird> can render it appropriately.

=back

Note that this module does not help you import statuses from Twitter.
For that purpose, I recommend L<Net::Twitter::Loader>.

By default, this module exports nothing.
You can import the following functions individually and/or by tags.
Import C<":all"> to import all functions at once.

=head1 :transform TAG FUNCTIONS

These functions transform a single status object and return the result.
The transformation is B<destructive>.

=head2 $status = trans_twitter_all($status, [$api_url])

Applies all transformations described below to the given C<$status>.

Argument C<$api_url> is optional. See C<trans_twitter_status_id()> function below.

=head2 $status = trans_twitter_search_status($status)

Transforms the C<$status> returned by Twitter's Search API v1.0 into something more like a normal status object.

=head2 $status = trans_twitter_status_id($status, [$api_url])

Transforms the C<$status>'s ID fields so that they include API URL of the source.
This transformation is recommended when you load statuses from multiple sources, e.g. twitter.com and loadaverage.org.

Argument C<$api_url> is optional. By default it is C<"https://api.twitter.com/1.1/">.
You should set it appropriately if you import statuses from other sites.

The original IDs are saved under C<< $status->{busybird}{original} >>

=head2 $status = trans_twitter_unescape($status)

Unescapes some HTML entities in the C<$status>'s text field.

HTML-unescape is necessary because twitter.com automatically HTML-escapes some special characters,
AND L<BusyBird> also HTML-escapes status texts when it renders them.
This results in double HTML-escapes.

The transformation changes the status's text length.
C<"indices"> fields in the status's L<Twitter Entities|https://dev.twitter.com/docs/platform-objects/entities> are
adjusted appropriately.

The transformation is applied recursively to the status's C<retweeted_status>, if any.

=head1 :filter TAG FUNCTIONS

These functions generate a synchronous status filter corresponding to the C<trans_twitter_*> functions.

All filters are non-destructive. That is, they won't modify input statuses. Transformation is done to their clones.

=head2 $filter = filter_twitter_all([$api_url])

=head2 $filter = filter_twitter_search_status()

=head2 $filter = filter_twitter_status_id([$api_url])

=head2 $filter = filter_twitter_unescape()

=head1 SEE ALSO

=over

=item *

L<BusyBird::Filter>

=item *

L<Net::Twitter>

=item *

L<Net::Twitter::Lite>

=item *

L<Net::Twitter::Loader>

=back

=head1 AUTHOR

Toshio Ito C<< <toshioito [at] cpan.org> >>

=cut



( run in 0.648 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )