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

Allow pulling from media tab #131

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

Pigglebear
Copy link
Contributor

I pulled the /UserMedia url ending with web browser dev tools and played around with modifying user_tweets_raw() and user_tweets(). Only a few parameters needed changing in these two functions to make it work.

I had to modify _gql_items() to pass a modified version of GQL_FEATURES when media was requested.

The return from twitter is slightly different for media and tweets. get_by_path() does not reach the actual content on the first call in the loop, but setting els equal to els[0]["content"]["items"] allows it to find the content and cursor.

Confusingly, the the second and subsequent call return a different format again. This time, if get_by_path() is set to "moduleItems" instead of "entries", the code can find all the the goods.

Some error handling may need to be added, but I have not run into issues.

When I used the new code, using user_media() was much faster than using user_tweets() and filtering out retweets and no media posts.

Thanks,
Pigglebear.

@github-actions github-actions bot added the Stale label Mar 29, 2024
@github-actions github-actions bot closed this Apr 3, 2024
@vladkens vladkens reopened this Apr 18, 2024
@vladkens vladkens removed the Stale label Apr 18, 2024
@vladkens vladkens changed the base branch from main to latest-release April 18, 2024 14:03
@vladkens vladkens merged commit a2f2a94 into vladkens:latest-release Apr 18, 2024
@vladkens
Copy link
Owner

@Pigglebear thank you!

@vladkens vladkens added this to the v0.12 milestone Apr 18, 2024
vladkens added a commit that referenced this pull request Apr 18, 2024
vladkens added a commit that referenced this pull request Apr 18, 2024
Co-authored-by: Pigglebear <144563781+Pigglebear@users.noreply.github.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants