Analysis is very important! Twitter Portlet

来源:互联网 发布:mac os 如何截图 编辑:程序博客网 时间:2024/06/05 01:20

Recently, I was doing twitter portlet. The task seems not hard. I have a list of twitter account, I just need to fetch them and display in my portlet. Last week, I got the task and don't know what twitter portlet is doing. I downloaded twitter portlet from Liferay marketplace. I tried two versions: 6.1.0 and 6.1.20. Both of them don't work properly. We can config twitter screen name in my account in Liferay under Social Networking category. Then it says tweets will be shown in Activities portlet. But we see nothing.

Then I downloaded twitter portlet source code online, and try to figure how it works. Then I see the url which is used to get tweets isn't correct now. I don't know why, then I see a lot of people use another API, I tried it. It works. When I almost complete the first version twitter portlet. The way to get twitter screen name changes, so I have to start from scratch. I took me 3 days to complete the new version twitter portlet. I use Service Builder to do that. Then I found another problem. Because I use REST API, it has rate limit. Every unauthenticated user can access the API 150 per hour. Every authenticated user has 350 limits. When I saw the policy, I was really depressed. I need to find a new solutions and I might start from scratch again.

Then I found Streaming API, it has no rate limit. I spent a whole day to read the api and tried to know how to program based on the API. The most confused thing for me is request credentials. They use very professional name to describe it -  OAuth. I have no idea about that. Yesterday, I felt I'm going to die. I'm getting to run out of my time. The new API is totally new. I don't know how to deal with OAuth. I might need to programs to do the thing. There're a lot of questions based on the new API.

Today I feel much better, I found a solution for that. The turning point is I asked a question on Twitter Discussion and got answer from@episod. He is very helpful. Now I have ideas about how to go ahead. If I could do more research on Twitter API, I might already finish the task. I wasted a lot of time on doing other stuff.

The good thing is I have a deep understanding on how Activities portlet works and how twitter portlet on Liferay market work. It might  be true only I had the basic knowledge on twitter portlet, then I can do followed programming.

The last word I want to share is: More preparation may quicken the speed in doing work. 磨刀不误砍柴工。

原创粉丝点击