Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

need help with twitter API and finding a front-end for the results

Posted on 2013-12-05
6
Medium Priority
?
356 Views
Last Modified: 2013-12-13
Is there a way to create a twitter feed that does not include tweets that have links in them? Not sure what UI I could use for this...maybe make a feed for hootsuite.

I already port tweets with link in them to my feedly using a api.

I would like to somehow consume the other tweets but avoid the tweets with links in this view.

I was told I could use this -
I am assuming that requires mastering the API?? How do I get an application that can do this for me in a real-time basis and I can consume it via an interface?

If no answer, where can I find people to help me?
0
Comment
Question by:finnstone
  • 2
  • 2
  • 2
6 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 39701284
It doesn't look like the Twitter API handles filtering by link inclusion, but you can certainly set up the process yourself.  When you call /search/tweets, run the return through another function that examines the content of each return.  Remove the ones that contain links.
0
 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 39716953
You'll need to do whar routiner said: call the twitter api, and then process the return of the api through a routine to clean up tweets with links inside...
0
 

Author Comment

by:finnstone
ID: 39716968
I was hoping for a little more how-to on this one...he just restated the goal.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 39717525
What exactly you do expect? The twitter api does not provide a method to filter our tweets that contain links. So, this means that logically, you should receive the feed and apply the filter and deliver the feed clean of the tweets with link. How to do it, you are asking? That could be in many different ways, depending on the language you are using and your knowledge of the language libraries: you can use the most basic string functions, you can use regular expressions, you can have a specific library for that.

Now if you want collaboration on your code, you may start sharing it and ask more specific questions.
0
 
LVL 51

Accepted Solution

by:
Steve Bink earned 2000 total points
ID: 39718297
To be more specific:

You call the API with an HTTP call.  The standard Python library urllib2 is a popular way to accomplish that task.  How you build that call will depend on which API you're using.  It sounds like you want the Search API.

The return is going to be a JSON data set.  You can use the Python standard JSON library to turn that into an object or otherwise access the hierarchy.  

Find the section for tweets.  Iterate through each item in that section to discover if there is a link in the content.  You could use the Python standard RegEx library to find, for example '<a[^>]*href="[^"]+"[^>]*>', or maybe 'https?:\/\/'.  If your regex is not matched, add the item to a list of tweets that have no links.

That could all fit into a single class that knows how to call the API, parse the return properly, and allow for accessing your filtered list.

The reason it sounds like I'm just restating the goal is that the path to your goal is simply that straight-forward.  Call the API, filter the return, profit.
0
 

Author Comment

by:finnstone
ID: 39718308
This is awesome! Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question