-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Fix for new Twitter API change #95
Conversation
Remove unused `twitter` and `login` module as guest login is no longer available and user login also had their APIs changed.
Tested using user |
Wow, that's great thank you very much! I'll take a look at the code to be sure nothing is amiss and I'll merge if so. |
Added a dummy API class to help displaying a clearer message when the APIs were called before they were initialized. I'm also writing documentations for all the classes and methods I've added in this PR. |
To display a more user friendly message if APIs were called before they were initialized.
To display a more specific error message.
Probably a dumb ask but could you show and example of the command you used with the --output-cookie-file. I've tried with my Netscape cookie file and I just keep getting. |
@BakungaBronson Could you post the full command and log with Also note that user login with email and password is removed, so you shouldn't be using That being said, thanks for reminding me to update the command line documentation. I'll update this PR soon. |
Here is an example of how to use the fix from the code: from twspace_dl.api import API
from twspace_dl import Twspace, TwspaceDL, CookiesLoader
cookies = CookiesLoader.load("twitter.cookies")
API.init_apis(cookies)
twspace = Twspace.from_space_url(url)
twspace_dl = TwspaceDL(twspace, "filename")
twspace_dl.download()
|
This helped me fix it actually. I was using --output-cookie-file instead (no idea why). |
Hi |
Thanks for your help |
@michael-borisov Thanks for the quick example and the suggestion of the browser extension to export cookies. Also, you could import the from twspace_dl import API, Twspace, CookiesLoader, TwspaceDL @alimirjahani7 You could find the specs of the Netscape cookies format here: https://curl.se/docs/http-cookies.html. However, it is easier to just install a browser extension that exports the cookies in the Netscape format for you. Like what @michael-borisov suggested for Firefox and @BakungaBronson suggested for Chrome, and there's a whole bunch of extensions like these. Just search for "cookies" in the respective extensions store, but be sure to check their background (like whether they were open-source and their reputation), cause the last thing you want when browsing the internet is someone accessing your cookies without your permission. As for how long the cookies will remain valid, you could actually check that yourself in the "storage" tab of the dev tools. Usually pressing F12 while on the webpage you want to check would open it. On my end, both the |
Add short option `-c` for the long option `--input-cookie-file`.
OK, I've just found out that Twitter has put a strict API rate limit on the However, I've also found out a new endpoint that Twitter uses to retrieve user IDs, so I've implemented this endpoint as a backup for the Finally, I've removed unsupported command line options from the I'll update the |
I've updated the This PR is now complete and ready to merge once you've finished your review, unless Twitter changed their API again, but that could be fixed in another PR. |
Alright! Thank you so much for your hard work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this is high quality code and there's not much to say about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been linked in the previous comment oops.
Seems that Twitter also has a strict rate limit on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK looks good to me!
@mikelei8291 Is it okay for me to merge? |
Yes, please merge it. I'll address the rate limit issue in a new PR, but it may take some time. |
Thank you again |
Thank you too for the review and this awesome project! |
Fixes #94.
Almost rewrote the entire networking part. I had some inspirations from HitomaruKonpaku/twspace-crawler (ISC license), but all code was implemented on my on.
Tested locally with two spaces, one recorded and one with
master_url
provided. All worked as expected.Things to note:
withListeners
set tofalse
for theAudioSpaceById
endpoint, but all other listeners would be removed too. Not sure if it's worth implementing a toggle.)Other refactors and fixes:
__main__
.httpproxy
to the protocol whitelist of ffmpeg to support downloading over a proxy.