📜 ⬆️ ⬇️

TwiMem - Twitter + Memories = remember tweets for future generations

Not so long ago, I already shared with the public Habrjabr my experiments with the Twitter microblogging social service API.
Today I would like to tell and show my new project in the field of experiments with the same API.

I present to you a project that I born on one of the evenings, when, after unsuccessful attempts to find one of the old posts in my personal Twitter account with a link to the music album I needed at that moment, I thought that notes (memes from eng. memories) your own or even someone else's tweets. "

No sooner said than done:
TwiMem - add tweets to Memories

TwiMem - home page TwiMem - personal page

Task
We need to quickly and simply remember your tweet-post or a friend from the tape. So that in the future you can view your “memos” (memes) with the ability to delete them on your personal page, for example, by typing twimem.com/%user_name%
')
Decision
If we send your tweet-post by specifying the #twimem tag in the message text, it is immediately remembered by our website http://twimem.com , displayed on the main page, as well as in the personal page twimem.com/%user_name% , which can view everyone. And if you log in using your OAuth authorization from Twitter in your personal account, you can delete unnecessary memos (memes).

And that's all. Just like a penknife. I added to memes, when I needed to find a tweet, I didn’t need it - I deleted it. Of course, all messages are saved independently of Twitter, and even if it is unavailable it will be available on our website, which in general is almost a backup feature of its interesting tweets, taking into account future plans.

Namely - plans for the future
1. Make it possible to upload to an authorized user all his memes in XML format, such backup export.
2. Make tag processing in mem'ah with conversion to internal tags.
3. Personal Meme categories.
4. - 10. ??? Your ideas and suggestions?

Technical part
I'll tell you briefly about the technical side of things.
The application is written entirely in the PHP programming language. MySQL database. JavaScript is used in the frontend. Layout HTML + CSS, as well as programming JS (JQuery), PHP is all for me personally.

The whole application is technologically divided into 2 independent parts:

1. Spider (spyder), written in “clean” PHP in OOP style, I wrote my own class for working with Twitter REST API, which I don’t mind sharing, take it to my health .
Example of use:
$twitter = new Twitter( $twitter_name, $password );
$mentions = $twitter->get_friends_timeline();

The spider runs as a cli application on cron, scans all new tweets from the last launch on key tags, parses and stores them in the database.

2. Frontend, just the “face” of the site, where we show a dozen extreme memes on the main page. With links to personal pages of users. Everything is written on the CodeIgniter extended PHP framework, which I have loved so much. By the word extended, I mean 5-6 classes written by me without affecting the core framework, which expand my capabilities, for example, the following type of code is very beautiful and convenient for me:
$user = $this->model('user')->find_by_screen_name( $user, 1 );
automatically load the model, attach to the users table (plural) and find the user by the screen_name field by the magic method
or
$data['remembers'] = $this->model('memory')->order_by('date_at', 'DESC')->find( NULL, 10 );
these are chunks as well as loading and attaching a model, sampling the last 10 records with sorting

All this is “inspired by Rails ActiveRecord” and I hope to tell you, I will share a number of classes on this subject next time.
For OAuth authorization, I didn’t reinvent the wheel and quickly made a number of fixes using Elliot Haughin’s Twitter class for CodeIgniter.

In general, this is all that I would like to share today with the people of Habrhabr.

Thank you for your attention, I invite you to use TwiMem service and I will always be grateful for ideas on the development and further improvement of the service.

Source: https://habr.com/ru/post/99905/


All Articles