Sponsored Content
Special Forums UNIX and Linux Applications Need help for a newbie to stream tweets with the Terminal Post 302895328 by MichaelGauthier on Monday 31st of March 2014 08:30:44 AM
Old 03-31-2014
Question Need help for a newbie to stream tweets with the Terminal

Hey everyone,


First, I'm not sure whether I should have posted this thread under the basic Unix commands forum or not, so I apologize if this was not the best place to do so...


Then, as the title of this discussion suggests, I would like to stream specific tweets for research purposes (I am a PhD student (interested in linguistics, not computing... -.-')), and I first started learning a few basic things with Python, but I realized that it could (apparently) be possible with just the Terminal (I'm on Mac OS) and a program like Twurl (if I'm not mistaken), so I gave up Python, but thus far I have just been able to connect to Twitter via the command line, by using my API key and secret, but now I'm stuck and I can't figure out how to make requests to stream specific tweets according to key words, or geo-localization.
I have been spending the last three weeks learning the basics of the command line so that I can better understand how it works, but I still can't find a relatively recent tutorial which would be clear enough and basic enough for a complete newbie in computing to understand how to do that, so I desperately need help now, since I am working on streaming tweets for a research project, and the deadlines are now becoming more and more pressing... So my questions are:


1) I can connect to Twitter with the Terminal and Twurl by using my API key and secret, what is the next step?
2) How to make requests to extract tweets from specific cities and with specific key words?
3) How to start streaming?


Please try to be clear (at least in newbies' terms...) since all the topics I found on the Internet apparently assume a certain knowledge of programming basics, which I don't have and it is quite frustrating not to be able to understand why the commands don't work, or what to do to make it work, hence my need for clear explanations...


I thank you in advance for any help you may bring! Any advice would be invaluable at this point. Don't hesitate to tell me if you need any more info.


Best

Last edited by MichaelGauthier; 03-31-2014 at 09:37 AM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

connecting to unix through hyper terminal - as a dumb terminal

I just changed from windows NT to XP and I am no longer able to connect to my unix system. I used to use hyper terminal -- which acts as dumb terminal to my main frame unix system. I think one of the options used to be "direct to comX". This option isn't listed now. I use a serial port and the... (2 Replies)
Discussion started by: michelle
2 Replies

2. UNIX for Dummies Questions & Answers

Run the start script from the terminal? Newbie Time!

Hi, How do I "run a script"? I'm trying to start up some software called ElectroServer 3, and was told I just needed to "run the start script from the terminal to get things going". From the terminal, i use cd command to change to the software's directory, and I guess the script in question is... (4 Replies)
Discussion started by: waking_bear
4 Replies

3. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

4. OS X (Apple)

newbie looking for Terminal tutorials

I've just started learning about Unix and the Terminal in Mac OSX. I've found a few good starting resources, such as OSXFAQ - Technical News and Support for Mac OS X, but most of them are based on OSX 10.2 or thereabouts. Does anyone know of any good tutorials that specifically address Leopard? ... (1 Reply)
Discussion started by: mightypants
1 Replies

5. Linux

Terminal logging character problem -Newbie-

Im a complete newbie tryin to work with linux centos; in terminal wanted to log with script command; but output file has some strange characters when I try to open with gedit or bluefish terminal , gedit, bluefish encoding is utf-8 ; Script started on Mon 08 Mar 2010 03:32:39 PM EET... (2 Replies)
Discussion started by: anacondauser
2 Replies

6. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

7. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies

8. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies
Web::Scraper(3pm)					User Contributed Perl Documentation					 Web::Scraper(3pm)

NAME
Web::Scraper - Web Scraping Toolkit using HTML and CSS Selectors or XPath expressions SYNOPSIS
use URI; use Web::Scraper; # First, create your scraper block my $tweets = scraper { # Parse all LIs with the class "status", store them into a resulting # array 'tweets'. We embed another scraper for each tweet. process "li.status", "tweets[]" => scraper { # And, in that array, pull in the elementy with the class # "entry-content", "entry-date" and the link process ".entry-content", body => 'TEXT'; process ".entry-date", when => 'TEXT'; process 'a[rel="bookmark"]', link => '@href'; }; }; my $res = $tweets->scrape( URI->new("http://twitter.com/miyagawa") ); # The result has the populated tweets array for my $tweet (@{$res->{tweets}}) { print "$tweet->{body} $tweet->{when} (link: $tweet->{link}) "; } The structure would resemble this (visually) { tweets => [ { body => $body, when => $date, link => $uri }, { body => $body, when => $date, link => $uri }, ] } DESCRIPTION
Web::Scraper is a web scraper toolkit, inspired by Ruby's equivalent Scrapi. It provides a DSL-ish interface for traversing HTML documents and returning a neatly arranged Perl data strcuture. The scraper and process blocks provide a method to define what segments of a document to extract. It understands HTML and CSS Selectors as well as XPath expressions. METHODS
scraper $scraper = scraper { ... }; Creates a new Web::Scraper object by wrapping the DSL code that will be fired when scrape method is called. scrape $res = $scraper->scrape(URI->new($uri)); $res = $scraper->scrape($html_content); $res = $scraper->scrape($html_content); $res = $scraper->scrape($http_response); $res = $scraper->scrape($html_element); Retrieves the HTML from URI, HTTP::Response, HTML::Tree or text strings and creates a DOM object, then fires the callback scraper code to retrieve the data structure. If you pass URI or HTTP::Response object, Web::Scraper will automatically guesses the encoding of the content by looking at Content-Type headers and META tags. Otherwise you need to decode the HTML to Unicode before passing it to scrape method. You can optionally pass the base URL when you pass the HTML content as a string instead of URI or HTTP::Response. $res = $scraper->scrape($html_content, "http://example.com/foo"); This way Web::Scraper can resolve the relative links found in the document. process scraper { process "tag.class", key => 'TEXT'; process '//tag[contains(@foo, "bar")]', key2 => '@attr'; process '//comment()', 'comments[]' => 'TEXT'; }; process is the method to find matching elements from HTML with CSS selector or XPath expression, then extract text or attributes into the result stash. If the first argument begins with "//" or "id(" it's treated as an XPath expression and otherwise CSS selector. # <span class="date">2008/12/21</span> # date => "2008/12/21" process ".date", date => 'TEXT'; # <div class="body"><a href="http://example.com/">foo</a></div> # link => URI->new("http://example.com/") process ".body > a", link => '@href'; # <div class="body"><!-- HTML Comment here --><a href="http://example.com/">foo</a></div> # comment => " HTML Comment here " # # NOTES: A comment nodes are accessed when installed # the HTML::TreeBuilder::XPath (version >= 0.14) and/or # the HTML::TreeBuilder::LibXML (version >= 0.13) process "//div[contains(@class, 'body')]/comment()", comment => 'TEXT'; # <div class="body"><a href="http://example.com/">foo</a></div> # link => URI->new("http://example.com/"), text => "foo" process ".body > a", link => '@href', text => 'TEXT'; # <ul><li>foo</li><li>bar</li></ul> # list => [ "foo", "bar" ] process "li", "list[]" => "TEXT"; # <ul><li id="1">foo</li><li id="2">bar</li></ul> # list => [ { id => "1", text => "foo" }, { id => "2", text => "bar" } ]; process "li", "list[]" => { id => '@id', text => "TEXT" }; EXAMPLES
There are many examples in the "eg/" dir packaged in this distribution. It is recommended to look through these. NESTED SCRAPERS
TBD FILTERS
TBD AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net> LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
<http://blog.labnotes.org/category/scrapi/> HTML::TreeBuilder::XPath perl v5.14.2 2011-11-19 Web::Scraper(3pm)
All times are GMT -4. The time now is 04:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy