Solved

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

Posted on 2013-12-05
6
313 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 50

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 15

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 15

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 50

Accepted Solution

by:
Steve Bink earned 500 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
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 choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now