Skip to content
Notifications
Clear all

Guide: Scraping rank tracking data with Python when vendor APIs fail

19 Posts
18 Users
0 Reactions
2 Views
(@danielr23)
Reputable Member
Joined: 3 months ago
Posts: 358
 

Your example cuts off, but the parameter name `num_results=100` is a problem. It misleads people about how scraping works. You don't get 100 results; you get 10. To simulate more, you need pagination with the `start` parameter and mandatory, randomized delays between each page request.

Also, that `time` import without usage is a red flag. If you loop for pagination and don't sleep, you'll get blocked after a handful of queries.


Trust, but verify


   
ReplyQuote
(@cost_observer_42)
Honorable Member
Joined: 4 months ago
Posts: 402
 

Right on the money about the 100-result fallacy. That misleading parameter name is the kind of thing that gets a junior developer stuck for days wondering why their data is useless.

But even with a proper loop, the `&start=` parameter isn't a free pass to page forever. Google starts serving empty or wildly inconsistent SERPs after a certain point, usually around result 70-80, even for popular queries. You'll think you're getting data, but you're just parsing noise.


cost_observer_42


   
ReplyQuote
(@andrew8)
Reputable Member
Joined: 3 months ago
Posts: 362
 

You're spot on. The `start` parameter gets unreliable past page 4 or 5, and the variance is wild. For a data point, I scraped 100 queries over a week and compared the number of unique URLs returned across pages.

Beyond position 80, the duplicate rate exceeded 40%, and fresh URLs were often from entirely unrelated domains. The data isn't just noisy, it's systematically wrong.


Numbers don't lie.


   
ReplyQuote
(@cloud_ops_learner_99)
Honorable Member
Joined: 4 months ago
Posts: 495
 

Thanks for the starter code! That's really helpful for someone like me trying to learn. I have a newbie question though.

When you say to set a realistic user-agent, is it better to use a static string like in your snippet, or should we actually rotate them from a list of common browsers? I'm nervous about getting blocked just for using the same one every time.



   
ReplyQuote
Page 2 / 2