GithubHelp home page GithubHelp logo

ptwobrussell / recipes-for-mining-twitter Goto Github PK

View Code? Open in Web Editor NEW
382.0 382.0 145.0 684 KB

Adaptations and Extensions of Twitter-Related Examples from Mining the Social Web

Home Page: http://amzn.to/d1Ci8A

Python 8.90% JavaScript 91.10%

recipes-for-mining-twitter's People

Contributors

ptwobrussell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recipes-for-mining-twitter's Issues

API version error

Hi, when I run the code for the trends recipe I get this error:
"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68. Kindly advise

Issues with the code examples

Hi,

First of all, thank you for writing the book and releasing the code!

I am having some issues in running the example.

After installing the required packages such as networkx and twitter package,
I ran recipe__visualize_rt_graph_protovis.py by typing the following:

$: ecipe__visualize_rt_graph_protovis.py japan

Than i received the following error:

Traceback (most recent call last):
File "recipe__visualize_rt_graph_protovis.py", line 71, in
page=page))
File "/usr/local/lib/python2.6/dist-packages/twitter-1.6-py2.6.egg/twitter/api.py", line 150, in call
return self._handle_response(req, uri, arg_data)
File "/usr/local/lib/python2.6/dist-packages/twitter-1.6-py2.6.egg/twitter/api.py", line 165, in _handle_response
raise TwitterHTTPError(e, uri, self.format, arg_data)
twitter.api.TwitterHTTPError: Twitter sent status 404 for URL: 1/search.json using parameters: (q=japan&rpp=100&page=1)
details:

<title>The page you were looking for doesn't exist (404)</title> <style type="text/css"> body { background-color: #fff; font-family: Helvetica, sans-serif; } h1 { margin: 10px 0; } img { border: 0; } </style>

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

May I know what am I doing wrong?

Am I missing something?

Best Regards,
Eugene

Weird bug with Summarizing Link Target recipe

Hi there!

I was trying out the Summarizing Link Target and i received the following error:

( i named the file as twitter_solution.py )

Traceback (most recent call last):
File "twitter_solution.py", line 127, in
summary = summarize(clean_page)
File "twitter_solution.py", line 76, in summarize
sentences = [s for s in nltk.tokenize.sent_tokenize(txt)]
File "/usr/lib/pymodules/python2.6/nltk/tokenize/init.py", line 43, in sent_tokenize
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
File "/usr/lib/pymodules/python2.6/nltk/data.py", line 590, in load
resource_val = pickle.load(_open(resource_url))
File "/usr/lib/pymodules/python2.6/nltk/data.py", line 669, in _open
return find(path).open()
File "/usr/lib/pymodules/python2.6/nltk/data.py", line 439, in find
try: return find(modified_name)
File "/usr/lib/pymodules/python2.6/nltk/data.py", line 429, in find
try: return ZipFilePathPointer(p, zipentry)
File "/usr/lib/pymodules/python2.6/nltk/data.py", line 306, in init
zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
File "/usr/lib/pymodules/python2.6/nltk/data.py", line 721, in init
zipfile.ZipFile.init(self, filename)
File "/usr/lib/python2.6/zipfile.py", line 696, in init
self._GetContents()
File "/usr/lib/python2.6/zipfile.py", line 716, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.6/zipfile.py", line 728, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

May i know if there's anything wrong ?

I am using NLTK 2.0b8 on my Ubuntu 10.04 computer.

May i know how do i fix this issue ?

Thanks!

Tweepy example

Hi,

thanks for your example on using tweepy for mining Twitter.

I installed tweepy (version 1.7.1), copied your code and inserted the details I got from Twitter.

However, I get the following error message on debugging:

Traceback (most recent call last):
File "C:\Programming\Scripts\test.py", line 65, in
streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)
TypeError: init() takes at least 4 arguments (4 given)

Do you have experienced the same issue?

Thanks for your help,
majom

Example 1-16 "TypeError"

The other recipes for visualizing retweet relationships work well, but I am stumped by this error for 1-16. Here's the traceback:
Traceback (most recent call last):
File "recipe__visualize_rt_graph_protovis.py", line 85, in
write_protovis_output(g, f, HTML_TEMPLATE)
File "recipe__visualize_rt_graph_protovis.py", line 33, in write_protovis_output
html = open(html_template).read() % (json_data,)
TypeError: not all arguments converted during string formatting

Any ideas?

issue fo recipe__streaming_api.py

got this error for recipe__streaming_api.py

Traceback (most recent call last):
File "stream_tweepy.py", line 65, in
streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)
TypeError: init() takes at least 4 non-keyword arguments (3 given)

Issues running the recipe_streaming_api

HI

when I try to run the above code exactly as in this example I get two errors:

  1. Traceback (most recent call last):
    File "C:\Python27\Lib\site-packages\xy\out\GeoSpatial\Streamings.py", line 73, in
    streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)
    TypeError: init() takes at least 4 arguments (4 given)

When I try pass just the 'auth' parameter the above error comes. I've upgraded tweepy to 1.7.1 and still the same error.

  1. More weirdly though, is that when it does run it only does for approximately 22 seconds before terminating and there is no output in the console.

The code is exactly as yours and the argv i'm passing is something like JustinBieber and other high volume queriies.

Thanks

Error in recipe__oauth_login.py

Traceback (most recent call last):
While i try to execute this file, i am getting this error,what should i do?

File "C:\Users\TOSHIBA\Desktop\py.PY", line 39, in
oauth_login(APP_NAME, CONSUMER_KEY, CONSUMER_SECRET)
File "C:\Users\TOSHIBA\Desktop\py.PY", line 17, in oauth_login
consumer_secret)
File "build\bdist.win-amd64\egg\twitter\oauth_dance.py", line 35, in oauth_dance
twitter.oauth.request_token())
File "build\bdist.win-amd64\egg\twitter\api.py", line 159, in call
arg_data = self.auth.encode_params(uriBase, method, kwargs)
File "build\bdist.win-amd64\egg\twitter\oauth.py", line 105, in encode_params
enc_params = urlencode_noplus(sorted(params.items()))
File "build\bdist.win-amd64\egg\twitter\oauth.py", line 132, in urlencode_noplus
return urlencode(query, safe='~').replace("+", "%20")
TypeError: urlencode() got an unexpected keyword argument 'safe'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.