[Paper Review] A Web Scraping Methodology for Bypassing Twitter API Restrictions
The authors propose a Scrapy-based web scraping approach to collect historical Twitter data beyond API limits, with a Django UI and Scrapyd daemonization for scalable crawling.
Retrieving information from social networks is the first and primordial step many data analysis fields such as Natural Language Processing, Sentiment Analysis and Machine Learning. Important data science tasks relay on historical data gathering for further predictive results. Most of the recent works use Twitter API, a public platform for collecting public streams of information, which allows querying chronological tweets for no more than three weeks old. In this paper, we present a new methodology for collecting historical tweets within any date range using web scraping techniques bypassing for Twitter API restrictions.
Motivation & Objective
- Motivate the need for historical Twitter data for NLP, ML, and sentiment analysis beyond API constraints.
- Propose a web scraping methodology that leverages Twitter Search endpoints to collect large tweet volumes over extended date ranges.
- Demonstrate a deployable, daemonized system with a GUI for launching and monitoring crawlers.
Proposed method
- Use Twitter Search endpoints with custom HTTP headers to construct advanced queries.
- Implement a Scrapy-based crawler to extract tweets from HTML payloads and parse tweet fields.
- Use a two-endpoint strategy: an initial search endpoint and a secondary timeline endpoint for older results (via maximum-position).
- Iteratively paginate using the maximum-position value to retrieve multiple rounds of tweets.
- Provide a command-line interface and a Django GUI bound to scrapyd for daemonized, scheduled crawling.
- Store retrieved tweets in relational or non-relational databases through a Scrapy pipeline.
Experimental results
Research questions
- RQ1Can historical tweets be retrieved beyond the standard 3-week window using web scraping of public search endpoints?
- RQ2How effectively can a Scrapy-based pipeline collect and process tweets with pagination across extended date ranges?
- RQ3What is the performance trade-off between Twitter API and a web-scraping approach in terms of total tweets, time, and reach?
- RQ4Can a GUI and daemonized architecture simplify large-scale, reproducible tweet data collection?
Key findings
- Twitter Scrapy retrieved 48,929 tweets vs 46,000 for the Twitter API Stream within the same date range, reducing total time from 1800s to 1893s (note: values shown in Table 3).
- Twitter Scrapy excluding retweets and mentions retrieved 48,601 tweets with 1,021 seconds whereas API Search excluding retweets and mentions retrieved 47,582 tweets with 2109 seconds.
- For a 9-10-2017 to 19-10-2017 range, Twitter API Search yielded 29,895 tweets, while Twitter Scrapy yielded 64,531 tweets.
- The methodology uses two endpoints and a maximum-position-based pagination to access older tweets beyond the initial results.
- A Django GUI with Scrapyd daemon enables scheduling, monitoring, and deployment of the scraping tasks in an EC2 environment.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.