简体   繁体   中英

Obtaining a reference to the streamManager of the internal object model on twitter.com

For a Greasemonkey script running on twitter.com, I need to access the twttr.streams.TweetStream instance of the main timeline (dubbed 'Home' internally) programmatically. I'm using Firebug and Javascript Deminifier to bring their JS code into a readable form. That way, I could previously work out that I could access it via twttr.app.currentPage().streamManager.streams.current in my GM script.

This has worked perfectly over the last months. Today, Twitter seems to have changed their code, breaking my approach (not their fault, obviously;)).

I can still get to the current page via twttr.app.currentPage() . However, it doesn't have a streamManager field anymore.

I've tried various paths to get there, but all were dead ends. Unfortunately, I don't completely understand the class system they are using yet. It seems like the streamManager property is still there -- on a mixin called mixins/streamablePage , which should be provided by the class twttr.components.pages.Home . I can't figure out how to access it, though. (Or if the class system hides it in some impenetrable way.) That mixin also provides a getStreamManager() method, but I can't access that either, eg via twttr.app.currentPage().getStreamManager() . Is there any trick I need to perform to get access to these mixins from the outside?

Can anyone spot an alternative method to get to this instance? Note that I need the original instance used on the timeline page. Yes, I could easily create a new instance via new twttr.streams.TweetStream() , but I'm trying to hook into the original events.

I am perfectly aware that this use case is as unsupported as it gets, that's why I'm asking you, not them. :) For the record, I'm not attempting to do anything evil, just providing additional functionality for myself.

Until they change it again, twttr.app.currentPage()._instance.getStreamManager()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM