question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to manually specify expansions and fields

See original GitHub issue

Normally, twarc aims to grab everything. But this seems like it’s causing problems in the API if the requests are too big, eg #449

It would be good to have a manual override for the expansions and fields. The extra command line parameters to align with the API https://developer.twitter.com/en/docs/twitter-api/data-dictionary/using-fields-and-expansions should have:

--expansions "author_id,geo.place_id" where the valid ones are: https://github.com/DocNow/twarc/blob/main/twarc/expansions.py#L16

Same for:

--user-fields

--tweet-fields

--media-fields

--poll-fields

--place-fields

Ideally it should also complain with an error or automatically set things fro you - if you specify --poll-fields but fail to specify attachments.poll_ids in --expansions. It would be nice to parse these and validate them for the user, but if that’s too complicated and cumbersome, just a check and a warning should be enough.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
SamHamescommented, Sep 28, 2021

How are we feeling about this now?

Based on a bit more handson work with the API, the only thing I’d really want to turn off is the context annotations so that I can collect data faster. Maybe instead of full customisability an off-by-default --exclude-context-annotations flag to support the 500 requests/page would cover most of this?

1reaction
SamHamescommented, Jun 24, 2021

I’m a hard disagree on this one right now. We’re really only a few months into early access, I think it’s a little premature to be working around Twitter’s API instability. Especially since that has impacts on downstream plugins.

Also I live 15000km from most of the internet, so 503’s aren’t exactly rare 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using fields and expansions | Docs | Twitter Developer Platform
This guide will show you how to use the fields and expansions query parameters ... Add the query parameter to the GET /tweets...
Read more >
Using v2 endpoints - Academic Research - Twitter Developers
By default you will only be able to access the Tweet object unless you have expansions set in your payload. This resource may...
Read more >
python - Problem with getting user.fields from Twitter API 2.0
I want to load tweets from Twitter API 2.0 endpoint and try to get the standard fields (author, text, ...) and some expansion...
Read more >
About expanded text ads - Google Ads Help
You'll still be able to pause and resume your expanded text ads, ... To get started with using the new optional fields, try...
Read more >
Compose file version 3 reference - Docker Documentation
Add build arguments, which are environment variables accessible only during the build process. First, specify the arguments in your Dockerfile:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found