This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Error with get_all_tweets and a large number of users: something went wrong. Status code: 431 #184
Labels
Comments
Please read the API documentation on the limitations of query length. Your query has 12400 characters, while the max. allowed by Twitter is 1024. require(academictwitteR)
#> Loading required package: academictwitteR
mps <- c(
"zarahsultana",
"Y_FovargueMP",
"YvetteCooperMP",
"YasminQureshiMP",
"William_Wragg",
"BillCashMP",
"willquince",
"wesstreeting",
"Wera_Hobhouse",
"morton_wendy",
"wendychambLD",
"WayneDavid_MP",
"VirendraSharma",
"VictoriaPrentis",
"vickyfoxcroft",
"vickyford",
"Valerie_VazMP",
"TulipSiddiq",
"TracyBrabin",
"tracey_crouch",
"tony4rochdale",
"ToniaAntoniazzi",
"TommySheppard",
"TomTugendhat",
"Tom_Randall",
"VotePursglove",
"tomhunt1988",
"tobyperkinsmp",
"Tobias_Ellwood",
"timloughton",
"timfarron",
"theresa_may",
"theodoraclarke",
"ThangamMP",
"TanDhesi",
"TaiwoOwatemi",
"TahirAliMP",
"Q66Suzi",
"SuellaBraverman",
"Stuart4WolvesSW",
"Stuart_McDonald",
"StuartAndrew",
"StewartMcDonald",
"StewartHosieSNP",
"StevenBonnarSNP",
"SteveBakerHW",
"SteveReedMP",
"steve_mccabe",
"stevedouble",
"BrineMP",
"stephenctimms",
"StephenMorganMP",
"Metcalfe_SBET",
"SMcPartland",
"SKinnock",
"S_Hammond",
"StephenFlynnSNP",
"StephenFarryMP",
"SDoughtyMP",
"SCrabbPembs",
"SteveBarclay",
"Steph_Peacock",
"stellacreasy",
"Siobhan_Baillie",
"Siobhain_Mc",
"simonjamesjupp",
"Simon4NDorset",
"Simonhartmp",
"simonfell",
"SimonClarkeMP",
"baynes_simon",
"sheryllmurray",
"Shaun4WBW",
"SharonHodgsonMP",
"ShaileshVara",
"ShabanaMahmood",
"SelaineSaxby",
"SeemaMalhotra1",
"scottmann4NC",
"ScottBentonMP",
"SarahOwen_",
"sarahjolney1",
"LabourSJ",
"SarahGreenLD",
"Dines4Dales",
"SarahChampionMP",
"AthertonNWales",
"SarBritcliffeMP",
"bhatti_saqib",
"eastantrimmp",
"SamTarry",
"SallyAnn1066",
"sajidjavid",
"RuthNewportWest",
"RuthEdwardsMP",
"RuthCadbury",
"rushanaraali",
"Royston_Smith",
"RosieDuffield1",
"rosie4westlancs",
"ronniecowan",
"SirRogerGale",
"WalkerWorcester",
"RobinMillarMP",
"RobertSyms",
"neill_bob",
"robertlargan",
"RobertJenrick",
"halfon4harlowMP",
"robertcourts",
"RobertBuckland",
"_RobbieMoore",
"AylesburyTories",
"RishiSunak",
"RicHolden",
"RichardGrahamUK",
"RThomsonMP",
"RichardBurgon",
"richardbaconmp",
"Rehman_Chishti",
"pow_rebecca",
"RLong_Bailey",
"RebeccaHarrisMP",
"TeamRanil",
"RachelReevesMP",
"redditchrachel",
"rach_hopkins",
"RachaelMaskell",
"pritipatel",
"PreetKGillMP",
"Dunne4Ludlow",
"PhilipDaviesUK",
"peterkyle",
"PeterGrantMP",
"Gibbo4Darlo",
"Peter_Dowd",
"PeterBoneUK",
"peter_aldous",
"PeteWishart",
"PennyMordaunt",
"Pauline_Latham",
"PaulaBarkerMP",
"scullyp",
"PaulMaynardUK",
"PaulMaskeyMP",
"PaulHowellMP",
"pauljholmes",
"PaulGirvanMP",
"paulbristow79",
"PaulBlomfieldMP",
"GradySNP",
"PGibsonSNP",
"patmcfaddenmp",
"OwenThompson",
"OwenPaterson",
"OrfhlaithBegley",
"_OliviaBlake",
"OliverHealdUK",
"OliverDowden",
"Nus_Ghani",
"nigelmills",
"HuddlestonNigel",
"nigelmp",
"nadams",
"Nicola4WBE",
"twocitiesnickie",
"NickTorfaen",
"BlaenauGwentMP",
"NickGibbUK",
"NickFletcherMP",
"NiaGriffithMP",
"neil_parish",
"NeilDotObrien",
"DrNeilHudson",
"neilgraysnp",
"coyleneil",
"JNHanvey",
"NazShahBfd",
"NavPMishra",
"NatalieElphicke",
"NadiaWhittomeMP",
"nadhimzahawi",
"munirawilson",
"YasinForBedford",
"mimsdavies",
"mikejwood",
"MikeKaneMP",
"MikeAmesburyMP",
"MickeyBradySF",
"MickWhitleyMP",
"gildernewm",
"michelledonelan",
"Michael4MDNP",
"michaelgove",
"Mike_Fabricant",
"Michael_Ellis1",
"MhairiBlack",
"MelJStride",
"Meg_HillierMP",
"mtpennycook",
"Offord4Hendon",
"MattHancock",
"MattWestern_",
"mattwarman",
"Matt_VickersMP",
"MattRodda",
"MaryRobinson01",
"GlindonMary",
"marykfoy",
"MartynDaySNP",
"MartinVickers",
"MartinJDocherty",
"MarshadeCordova",
"MarkTamiMP",
"Mark_Spencer",
"MPritchardUK",
"MarkPawsey",
"markjenkinsonmp",
"MpHendrick",
"Mark_J_Harper",
"Mark4WyreForest",
"mark4dewsbury",
"marionfellows",
"MarieRimmer",
"MariaMillerUK",
"meaglemp",
"mariacaulfield",
"margarethodge",
"MGreenwoodWW",
"MargaretFerrier",
"Marcus4Nuneaton",
"MarcusFysh",
"marcolonghi4dn",
"maggie_erewash",
"lynbrownmp",
"LukePollard",
"LukeHall",
"drlukeevans",
"LucyMPowell",
"lucyfrazermp",
"lucyallan",
"LouHaigh",
"lloyd_rm",
"LizTwistMP",
"LSRPlaid",
"leicesterliz",
"lisanandy",
"DrLisaCameronMP",
"LindsayHoyle_MP",
"LilianGreenwood",
"liambyrnemp",
"lia_nici",
"LeoDochertyUK",
"Lee4NED",
"LeeAndersonMP",
"LaylaMoran",
"lrobertsonTewks",
"Laura__Farris",
"KwasiKwarteng",
"kitmalthouse",
"KirstySNP",
"kirstenoswald",
"KimJohnsonMP",
"KieranMullanUK",
"khalid4PB",
"kevinhollinrake",
"kevin_j_foster",
"KevinBrennanMP",
"KevanJonesMP",
"KerryMP",
"KennyMacAskill",
"KemiBadenoch",
"KellyTolhurst",
"Keir_Starmer",
"K_Fletcher_MP",
"KateOsborneMP",
"KateOsamor",
"Kate_HollernMP",
"KateGreenSU",
"KarlTurnerMP",
"karlmccartney",
"karinsmyth",
"KarenPBuckMP",
"JustinTomlinson",
"justinmadders",
"JulieMarsonMP",
"JulieElliottMP",
"JulianSturdy",
"JulianSmithUK",
"julianknight15",
"JuliaLopezMP",
"JudithCummins",
"joymorrissey",
"jreynoldsMP",
"JonathanLord",
"JDjanogly",
"JonAshworth",
"jon_trickett",
"JonCruddas_1",
"JohnnyMercerUK",
"JohnMcNallySNP",
"JWhittingdale",
"John4Carlisle",
"spellar",
"johnredwood",
"JohnPenroseNews",
"MrJohnNicolson",
"johnmcdonnellMP",
"John2Win",
"JHowellUK",
"JohnHealey_MP",
"JohnGlenUK",
"johnfinucane",
"JohnCryerMP",
"joannaccherry",
"JoStevensLabour",
"jogideon",
"Jochurchill4",
"JimShannonMP",
"JimfromOldham",
"Jill4Hartlepool",
"jessicamordenmp",
"Jesse_Norman",
"jessphillips",
"JeromeMayhew",
"Jeremy_Hunt",
"jeremycorbyn",
"J_Donaldson_MP",
"JeffSmithetc",
"JasonMcCartney",
"JanetDaby",
"Jane_Stevenson_",
"JaneMHunt",
"Jamie4North",
"JamieWallisMP",
"jamesowild",
"JamesSunderl",
"jamesmurray_ldn",
"JamesMorris",
"JSHeappey",
"JGray",
"JamesDuddridge",
"JamesDavies",
"JamesDalyMP",
"JamesCleverly",
"jc4southsuffolk",
"JBrokenshire",
"JakeBerry",
"JacobYoungMP",
"Jacob_Rees_Mogg",
"JackieDP",
"JackLopresti",
"JackDromeyMP",
"imranahmadkhan",
"Imran_HussainMP",
"IanMurrayMP",
"IanMearnsMP",
"IanLaveryMP",
"IanByrneMP",
"Ianblackford_MP",
"iainastewart",
"MPIainDS",
"HywelPlaidCymru",
"HuwMerriman",
"HollyLynch5",
"hilarybennmp",
"HenrySmithUK",
"Helen_Whately",
"helenhayes_",
"HelenGrantMP",
"HeatherWheeler",
"hbaldwin",
"HarrietHarman",
"HannahB4LiviMP",
"GuyOpperman",
"gregsmith_uk",
"GregKnight",
"GregHands",
"GregClarkMP",
"grantshapps",
"grahamemorris",
"grahamstuart",
"SirGrahamBrady",
"GillianKeegan",
"GillFurnissMP",
"GilesWatling",
"GeraldJonesLAB",
"GeraintDaviesMP",
"GeorgeFreemanMP",
"Geoffrey_Cox",
"GavinWilliamson",
"GRobinsonDUP",
"GavNewlandsSNP",
"garystreeterSWD",
"GarySambrook89",
"GarethThomasMP",
"GarethDavies_MP",
"GarethBaconMP",
"gaganmohindra",
"FrancieMolloy",
"FloEshalomi",
"PutneyFleur",
"FeryalClark",
"FelicityBuchan",
"JonesyFay",
"FabianLeedsNE",
"EstherMcVey1",
"EmmaLewellBuck",
"EmmaHardyMP",
"EmilyThornberry",
"ElliotColburn",
"elliereeves",
"trussliz",
"eleanor4epping",
"edwardtimpson",
"Ed_Miliband",
"EdwardLeighMP",
"EdwardJDavey",
"EddieHughes4WN",
"duncancbaker",
"drewhendrySNP",
"theresecoffey",
"RupaHuq",
"DrRosena",
"Dr_PhilippaW",
"LiamFox",
"drcarolinej",
"AWMurrison",
"alanwhiteheadmp",
"Douglas4Moray",
"DougChapmanSNP",
"DominicRaab",
"HackneyAbbott",
"DianaJohnsonMP",
"DesmondSwayne",
"DerekTwiggMP",
"DerekThomasUK",
"DeidreBrock",
"DehennaDavison",
"Debbie_abrahams",
"dean4watford",
"DawnButlerBrent",
"DJWarburton",
"DavidTCDavies",
"DSimmonds_RNP",
"DavidRutley",
"DavidMundellDCT",
"davidmorrisml",
"DavidLinden",
"DavidLammy",
"DavidJonesMP",
"david4wantage",
"DavidEvennett",
"david_duguid",
"DavidDavisMP",
"amessd_southend",
"DaveDooganSNP",
"darrenpjones",
"DarrenG_Henry",
"danny__kruger",
"DanielZeichner",
"DKShrewsbury",
"DanJarvisMP",
"DanCardenMP",
"DamianHinds",
"DamianGreen",
"DamianCollins",
"libdemdaisy",
"CrispinBlunt",
"craig4monty",
"CWhittaker_MP",
"craig4nwarks",
"cmackinlay",
"ConorMcGinn",
"ConorBurnsUK",
"columeastwood",
"labourlewis",
"CliveEfford",
"ClaudiaWebbe",
"ClaireHanna",
"ClaireCoutinho",
"ChrisPincher",
"ChrisHazzardSF",
"cajardineMP",
"Rees4Neath",
"Christian4BuryS",
"ChrisM4Chester",
"ChrisStephens",
"CSkidmoreUK",
"CPhilpOfficial",
"chrisloder",
"ChrisLawSNP",
"chhcalling",
"CGreenUK",
"Chris_EvansMP",
"CPJElmore",
"ChrisClarksonMP",
"RhonddaBryant",
"NorwichChloe",
"ChiOnwurah",
"thisischerilyn",
"charlotte2153",
"CharlesWalkerMP",
"CatherineWest1",
"CatMcKinnell",
"CatSmithMP",
"carolynharris24",
"carolinenokes",
"CarolineLucas",
"cj_dinenage",
"Caroline_Ansell",
"CMonaghanSNP",
"carlalockhart",
"bphillipsonMP",
"BrendanOHaraMP",
"Bren4Bassetlaw",
"BrandonLewis",
"BorisJohnson",
"IoWBobSeely",
"BobBlackman",
"BimAfolami",
"Bill_Esterson",
"BethWinterMP",
"bernardjenkin",
"BWallaceMP",
"DrBenSpencer",
"BenMLake",
"Ben_Everitt",
"BenPBradshaw",
"BBradley_Mans",
"BellRibeiroAddy",
"BarrySheerman",
"BarryGardiner",
"KeeleyMP",
"Bambos_MP",
"ApsanaBegumMP",
"antony_hig",
"AnthonyMangnal1",
"ab4scambs",
"AnnelieseDodds",
"annietrev",
"AnneMcLaughlin",
"AnneMarieMorris",
"AnnaMcMorrin",
"AngusMacNeilSNP",
"AJRichardsonMP",
"AngelaRayner",
"angelaeagle",
"hammersmithandy",
"AndyMcDonaldMP",
"MrAndy_Carter",
"Andrew4Pendle",
"AndrewSelous",
"AndrewRosindell",
"ALewerMBE",
"AJonesMP",
"GwynneMP",
"griffitha",
"ABridgen",
"AndrewBowie_MP",
"andrealeadsom",
"andreajenkyns",
"AmyCallaghanSNP",
"ASollowayUK",
"amandamilling",
"AlynSmith",
"AlunCairns",
"AlokSharma_RDG",
"amcarmichaelMP",
"alisonthewliss",
"Alison_McGovern",
"aliciakearns",
"Alex_Stafford",
"alexsobel",
"AlexNorrisNN",
"AlexDaviesJones",
"ACunninghamMP",
"AlexChalkChelt",
"alexburghart",
"AlecShelbrooke",
"AlbertoCostaMP",
"AlanMakMP",
"alancampbellmp",
"AlanBrownSNP",
"Afzal4Gorton",
"AdamAfriyie",
"abenaopp",
"AaronBell4NUL"
)
query <- build_query(users = mps)
nchar(query)
#> [1] 12400 Created on 2021-07-07 by the reprex package (v2.0.0) |
Ah right - thanks! |
Best way to approach this is just to write a for loop so you're splitting up the users. Nothing we can do to alter what Twitter allows, unfortunately! |
I had the same issue. Just wanted to point out that using the get_timelines function in rtweet package, it's possible to query a much larger number of users (1000+ users worked for me). I guess the query length limit is only an issue relevant to v2 of the twitter api. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
Trying to include a large number of users in a
get_all_tweets
command results in the following error:To Reproduce
The output I see in the R Studio console is:
Expected behavior
Start to collect tweets from all 588 MPs.
The code works when I do
users = mps[1:3]
, for example, but notusers = mps[1:588]
orusers = mps
. It isn't a bearer token issue, because other collections work fine - in the past I have got around this by running a for loop for groups of 40 or so MPs, but I would like to use the resume and update functions, so I want one overall query which can cover every MP in one go.Session Info:
Please run
sessionInfo()
and copy the result hereThe text was updated successfully, but these errors were encountered: