Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API v1.1 support required in loadtweets.php #39

Closed
doherty opened this Issue Jun 13, 2012 · 24 comments

Comments

Projects
None yet
10 participants
@doherty
Copy link

commented Jun 13, 2012

I'm intermittently seeing this error when the loadtweets.php cronjob runs. I haven't received this error ever when running the job manually.

"PHP Fatal error:  Cannot use object of type stdClass as array in loadtweets.php on line 171"
@graulund

This comment has been minimized.

Copy link
Owner

commented Jun 16, 2012

Hm. The variable being checked should be an object, since JSON data is always (with the settings I use, anyway) represented as an object, not an array, in PHP. Could be a connection error, which is represented as an array in the code, but that should be catched on line 166 in the same file.

It'd be helpful if you could output the full value of $data when this occurs, and paste it here.

@doherty

This comment has been minimized.

Copy link
Author

commented Nov 16, 2012

This is happening with some regularity. Can you provide a patch which logs the debugging output you want? I'm not sure how to trap a fatal error in PHP.

@doherty

This comment has been minimized.

Copy link
Author

commented Jun 12, 2013

Does loadtweets.php use API v1.1? If not, then I think support needs to be added.

I'm guessing the previous intermittent failures coincided with the blackouts of API v1. Today, Twitter turned off v1 entirely, forever, and this error is now 100% reproducible.

@navjotjsingh

This comment has been minimized.

Copy link

commented Jun 12, 2013

Has stopped working since yesterday. Though I am not getting the error mentioned here. Waiting for an update.

@graulund

This comment has been minimized.

Copy link
Owner

commented Jun 12, 2013

Well, crap. I was hoping to have the next version of Tweet Nest done before this moment, however due to me having a super busy spring and graduating university this month, regrettably this didn't come to pass. I won't have time to look at this issue again until next month.

If anyone has more time than me, feel free to implement an authentication system like abraham's twitteroauth in the current code, and ask me anything about that here. If not, I'm afraid we will all have to wait.

@Siemser

This comment has been minimized.

Copy link

commented Jun 12, 2013

Would you then please add twitter archive load like the one from user tralafiti?

@sr4136

This comment has been minimized.

Copy link

commented Jun 13, 2013

@ghost

This comment has been minimized.

Copy link

commented Jun 15, 2013

"Authentication required on all endpoints - In version 1.1, we're requiring applications to authenticate all of their requests with OAuth 1.0a or Application-only authentication."
From Version 1.1 of the Twitter API Documentation: https://dev.twitter.com/docs/api/1.1/overview

I posted more technical details on Issue #49.

@victorjacobs

This comment has been minimized.

Copy link
Contributor

commented Jun 16, 2013

I've actually started implementing this on my twitter11 branch. Not going to give an ETA since poking around in someone else's code is always tricky.

@astrobokonon

This comment has been minimized.

Copy link

commented Jun 16, 2013

@sr4136 Yes, with trivial changes (in lib/twitteroauth.php and inc/class.twitterapi.php) to point to the v1.1 api location that is exactly what's needed. I fixed mine this weekend and all is back to normal archiving away without errors. It's worth noting that I started with a fresh install since my DB was getting spammed with null entries once the v1.0 API went dark. That was referenced in a pull request that was closed (#42) so people are probably not seeing that the work is already more or less done to hack it back to working order.

Edit: Well, more or less; the favorites fetching never worked for me, but since favorites are just your own tweets it's a feature I don't mind ditching.

@Siemser

This comment has been minimized.

Copy link

commented Jun 17, 2013

@astrobokonon would you share ur loadtweets fix?

@victorjacobs

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2013

I fixed this here if you're interested: https://github.com/victorjacobs/tweetnest/tree/twitter11

@Siemser

This comment has been minimized.

Copy link

commented Jun 17, 2013

@victorjacobs thank you, will take a closer look at this tomorrow :)

@madsushi

This comment has been minimized.

Copy link

commented Jun 17, 2013

To add some more info on @victorjacobs awesome fix: you'll need to re-run the setup.php file from your browser to walk through generating the OAuth tokens with Twitter. To re-run setup.php, you need to have a clean config.php file. So you want to backup your config.php, overwrite your tweetnest directory with the version from @victorjacobs, run through setup.php, taking the values from your backed-up config.php.

@sr4136

This comment has been minimized.

Copy link

commented Jun 17, 2013

@victorjacobs that worked perfectly, thanks!

and @madsushi thanks for pointing out the re-running of the setup file.

@gr4y

This comment has been minimized.

Copy link

commented Jun 18, 2013

@victorjacobs Awesome work, man! Thank you! 👍

@victorjacobs

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2013

You're welcome! I requested @graulund to pull this into his master.

@SathyaBhat

This comment has been minimized.

Copy link

commented Jun 19, 2013

@victorjacobs Hey, I cloned your repo, switched over to the branch, copied the files & when I execute loadtweets.php, I'm getting the same error:

sathya /var/www/sbhat.me/tw/maintenance
$ php loadtweets.php
Trying to grab from user_id=11594372...
Importing:
User ID: 11594372
Total tweets: , Approx. page total: 0
Newest tweet I've got: 344557797431721984
Retrieving page #1: statuses/user_timeline.json?user_id=11594372&include_rts=true&include_entities=true&count=200&since_id=344557797431721984
1 new tweets on this page
PHP Fatal error:  Cannot use object of type stdClass as array in /var/www/sbhat.me/tw/maintenance/loadtweets.php on line 113

Fatal error: Cannot use object of type stdClass as array in /var/www/sbhat.me/tw/maintenance/loadtweets.php on line 113

Any idea why this is so?

@gr4y

This comment has been minimized.

Copy link

commented Jun 19, 2013

@SathyaBhat Like @madsushi pointed out in this thread you have to reinstall Tweetnest, cause the setup.php has to get an AccessToken from Twitter. Here's what you have to do: Copy your inc/config.php away, reinstall Tweetnest into the same database, but change your table_prefix. After reinstalling tweenest, you just change the table_prefix in inc/config.php back to the old value. (Don't replace your new inc/config.php with the old one!)

@SathyaBhat

This comment has been minimized.

Copy link

commented Jun 20, 2013

@gr4y yeah, that's pretty much what I had done - removed config, re-ran, setup with different db name, and then switched it over after the setup was done. Not sure if being dense or missing something else.

@Siemser

This comment has been minimized.

Copy link

commented Jun 20, 2013

@SathyaBhat you can also do a fresh Nest by importing your tweet archive so you won't loose your old tweets. Folder 'archive' and loadarchive.php from maintenance is needed from @tralafiti repo. Worked fine for me too. You only need to request the tweet archive on twitter.com in the settings and upload the monthly json in the archive folder and run loadarchive.php after you have run loaduser.php.

@SathyaBhat

This comment has been minimized.

Copy link

commented Jun 23, 2013

that stupid moment when you didn't switch branches after cloning :| Thanks @Siemser & @gr4y

@gr4y

This comment has been minimized.

Copy link

commented Jun 23, 2013

@SathyaBhat I haven't switched branches either the first time I reinstalled tweetnest. I thought that I am the only one who is that stupid. That's why I haven't asked you if you switched branches. 😆

@dasrecht dasrecht referenced this issue Jun 30, 2013

Merged

Twitter API 1.1 #50

@graulund

This comment has been minimized.

Copy link
Owner

commented Jul 2, 2013

Fixed in the newest version.

@graulund graulund closed this Jul 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.