A lightweight, self-hosted RSS 2.0 feed generator for public X (formerly Twitter) profiles, built entirely as a single PHP application with SQLite caching.
xsukax X RSS Generator fetches publicly accessible X profile HTML, extracts posts and media, stores them locally, and exposes the results as standards-compatible RSS feeds that can be consumed by RSS readers, automation platforms, monitoring systems, and other feed-aware applications.
No Composer packages, X API credentials, external database server, or cURL dependency are required.
xsukax X RSS Generator provides a simple way to follow public X profiles through RSS without requiring access to the official X API.
The application:
- Accepts an X username.
- Retrieves the corresponding public X profile page.
- Parses available posts from the returned HTML.
- Extracts post text, timestamps, links, and supported images.
- Stores retrieved data in a local SQLite database.
- Reuses cached data to reduce unnecessary requests.
- Generates a valid RSS 2.0 document.
- Serves the feed through a stable URL suitable for RSS clients.
The project is intentionally designed around minimal deployment complexity. The application logic, HTML interface, RSS renderer, caching system, parser, rate limiter, and database initialization all live inside a single index.php file.
The project focuses on:
- Simple self-hosting
- Minimal dependencies
- No official X API requirement
- No API keys or OAuth configuration
- RSS standards compatibility
- Local data caching
- Graceful handling of upstream failures
- Lightweight deployment
- Reasonable security defaults
- Easy maintenance when X markup changes
Important
This project parses publicly available X HTML rather than using an official API. Changes to X's HTML structure, anti-bot systems, or access policies may temporarily affect feed generation.
-
Generates standard RSS 2.0 feeds from public X profiles.
-
Supports direct feed URLs.
-
Includes standard RSS fields such as:
titlelinkdescriptionpubDateguid
-
Includes an Atom
rel="self"link for canonical feed identification. -
Uses
content:encodedfor rich post content. -
Produces plain-text descriptions for compatibility with simpler RSS readers.
-
Fetches public X profile HTML directly.
-
Does not require:
- X API credentials
- API keys
- OAuth
- Developer accounts
-
Extracts:
- Post text
- Post URLs
- Post IDs
- Publication timestamps
- Supported post images
-
Handles media-only posts.
-
Uses several timestamp detection strategies when necessary.
-
Restricts embedded media URLs to supported X image CDN locations.
Post images can be included in generated feeds through content:encoded.
Images are rendered responsively to improve compatibility with:
- Desktop RSS readers
- Mobile RSS applications
- Feed aggregators
- Web-based RSS clients
The generator intentionally keeps rich media in a single RSS content field to reduce duplicate image rendering in readers that process multiple RSS content representations.
- Zero-configuration SQLite storage.
- Database schema is created automatically.
- Per-profile cache.
- Default cache lifetime: 300 seconds / 5 minutes.
- Cached posts remain available when appropriate if a later X refresh fails.
- Automatic post de-duplication.
- Existing cached posts can be refreshed with updated content.
- HTTP validators such as
ETagandLast-Modifiedare reused when available.
Generated RSS responses support:
ETagIf-None-Match- HTTP
304 Not Modified Cache-Controlstale-if-error
This can significantly reduce bandwidth when RSS readers repeatedly request unchanged feeds.
Basic request limiting is included to reduce abuse and unnecessary upstream requests.
Default settings:
60 requests / 60 seconds / client IP
When the limit is exceeded, the application returns:
HTTP 429 Too Many Requests
with an appropriate Retry-After response header.
A lightweight responsive web interface is included.
Users can:
- Enter an X username.
- Choose the maximum number of feed items.
- Open the generated RSS feed.
- Force an immediate cache refresh.
- See refresh success or failure information.
The interface automatically supports browser light and dark color schemes.
The application includes special handling for browsers such as Firefox and Safari, which may otherwise download or delegate RSS documents instead of displaying XML directly.
RSS clients still receive the normal RSS MIME type.
Built-in protections include:
- Strict input validation
- PDO prepared statements
- CSRF protection for GUI actions
- HTTP-only session cookies
SameSite=Laxsession cookies- Content Security Policy
X-Frame-Options: DENYX-Content-Type-Options: nosniffReferrer-Policy: no-referrer- HTML output escaping
- TLS peer verification for upstream HTTPS requests
- Controlled Host header validation
- External entity/network protection during DOM parsing
- Restricted remote image sources
- Error display disabled for RSS output
- SQLite database permissions set to
0600when possible
The basic data flow is:
RSS Reader / Browser
|
v
index.php
|
+---- Validate username and feed limit
|
+---- Check SQLite cache
|
+---- Cache still fresh?
| |
| +---- Yes --> Use cached posts
| |
| +---- No
| |
| v
| Fetch public X profile
| |
| v
| Parse profile HTML
| |
| v
| Extract posts and media
| |
| v
| Update SQLite cache
|
v
Generate RSS 2.0
|
v
Browser / RSS Reader
No background process or cron job is required.
Feeds are refreshed when requested and the configured cache interval has expired.
The server must provide:
- PHP 8.0 or newer
- PDO
- PDO SQLite (
pdo_sqlite) - DOM
- libxml
- SQLite support
- HTTPS outbound connectivity to
x.com - PHP sessions
- A writable application directory for SQLite database creation
The following PHP configuration must also be enabled:
allow_url_fopen = OnThe project deliberately uses PHP's native HTTPS stream wrapper, so cURL is not required.
For production deployments:
- PHP 8.1+
- Nginx or Apache
- PHP-FPM
- HTTPS
- Current CA certificates
- A dedicated web-server user
- Proper file permissions
Check your PHP version:
php -vCheck the required extensions:
php -r '
foreach (["pdo_sqlite", "dom", "libxml"] as $extension) {
echo $extension . ": " .
(extension_loaded($extension) ? "OK" : "MISSING") .
PHP_EOL;
}
'Check allow_url_fopen:
php -r 'echo "allow_url_fopen=" . ini_get("allow_url_fopen") . PHP_EOL;'Expected result:
allow_url_fopen=1
Clone the repository:
git clone https://github.com/xsukax/xsukax-X-RSS-Generator.git
cd xsukax-X-RSS-GeneratorEnsure the main application file is named:
index.php
Verify its PHP syntax:
php -l index.phpIf everything is correct:
No syntax errors detected in index.php
Place the project inside your web server's document root or configure a dedicated virtual host for it.
Install PHP and the required extensions:
sudo apt update
sudo apt install php php-cli php-fpm php-sqlite3 php-xmlVerify the modules:
php -m | grep -Ei 'PDO|sqlite|dom|libxml'Clone the project:
cd /var/www
sudo git clone https://github.com/xsukax/xsukax-X-RSS-Generator.git xrssEnsure the PHP/web-server process can create the SQLite database in the application directory.
For example, if PHP runs as www-data:
sudo chown -R www-data:www-data /var/www/xrss
sudo chmod 750 /var/www/xrssAdjust permissions according to your own deployment model and security policy.
PHP's built-in development server can be used for testing:
git clone https://github.com/xsukax/xsukax-X-RSS-Generator.git
cd xsukax-X-RSS-Generator
php -d allow_url_fopen=1 -S 127.0.0.1:8000Open:
http://127.0.0.1:8000/
Warning
PHP's built-in web server is intended for development and testing. Use Nginx, Apache, or another production-grade web server for public deployments.
Configuration is intentionally kept simple.
Application settings are defined as constants near the beginning of index.php.
Example:
const APP_NAME = 'xsukax X RSS Generator';
const DB_FILE = __DIR__ . '/.xsukax-x-rss.sqlite';
const DEFAULT_LIMIT = 20;
const MIN_LIMIT = 1;
const MAX_LIMIT = 100;
const CACHE_TTL = 300;
const FETCH_TIMEOUT = 12;
const MAX_HTML_BYTES = 12_000_000;
const RATE_WINDOW = 60;
const RATE_MAX_REQUESTS = 60;| Setting | Default | Description |
|---|---|---|
APP_NAME |
xsukax X RSS Generator |
Application name |
DB_FILE |
.xsukax-x-rss.sqlite |
SQLite database location |
DEFAULT_LIMIT |
20 |
Default number of RSS items |
MIN_LIMIT |
1 |
Minimum allowed feed size |
MAX_LIMIT |
100 |
Maximum allowed feed size |
CACHE_TTL |
300 |
Seconds between normal upstream fetch attempts |
FETCH_TIMEOUT |
12 |
X HTTP request timeout |
MAX_HTML_BYTES |
12000000 |
Maximum accepted profile response size |
USER_AGENT |
Application-specific | HTTP User-Agent sent to X |
RATE_WINDOW |
60 |
Rate-limit window in seconds |
RATE_MAX_REQUESTS |
60 |
Requests allowed per client per window |
After changing PHP constants, no database migration is normally required.
The X-specific HTML selectors are deliberately kept together:
const POST_SELECTOR = 'article';
const STATUS_LINK_SELECTOR = 'a[href*="/status/"]';
const CONTENT_SELECTOR = 'div[dir="auto"]';
const TIME_SELECTOR = 'time[datetime]';
const IMAGE_SELECTOR = 'img[src]';If X changes its frontend markup, these selectors may need to be updated.
This centralized design makes parser maintenance easier.
Make sure:
allow_url_fopen = On
display_errors = Off
log_errors = OnRestart PHP-FPM or your web server after modifying php.ini.
Example:
sudo systemctl restart php8.4-fpmUse the PHP-FPM version installed on your own server.
Navigate to the application URL:
https://rss.example.com/
Enter:
- Username — an X username, with or without
@ - Limit — number of posts to include
The supported limit range is:
1 - 100
Click:
Open RSS
to open the generated feed.
Username:
xsukax
Limit:
20
The resulting feed will use a URL similar to:
https://rss.example.com/index.php?x=xsukax&l=20
Feeds can be accessed without the GUI.
Format:
index.php?x=USERNAME&l=LIMIT
Example:
https://rss.example.com/index.php?x=xsukax&l=20
If index.php is configured as the default directory index, this may also work:
https://rss.example.com/?x=xsukax&l=20
| Parameter | Required | Description |
|---|---|---|
x |
Yes | X username |
l |
No | Maximum items to return |
If l is omitted, the application uses:
20
The accepted range is:
1 - 100
A leading @ in the username is automatically removed.
Valid username characters are:
A-Z
a-z
0-9
_
You can test a feed with curl:
curl -i "http://127.0.0.1:8000/?x=xsukax&l=10"Save the generated RSS:
curl \
"http://127.0.0.1:8000/?x=xsukax&l=20" \
-o xsukax.xmlInspect the output:
head -n 30 xsukax.xmlCopy your generated URL:
https://rss.example.com/?x=xsukax&l=20
and add it to your preferred RSS client.
The feed can be used with software such as:
- FreshRSS
- Miniflux
- Feedly
- NetNewsWire
- NewsBlur
- Thunderbird
- Feedbro
- Other RSS 2.0-compatible applications
The normal feed endpoint respects CACHE_TTL.
To bypass the normal cache interval:
- Open the web interface.
- Enter the X username.
- Select a feed limit.
- Click Refresh cache now.
A manual refresh bypasses the normal cache TTL and attempts a fresh profile retrieval immediately.
The interface reports:
- Number of parsed items
- Number of newly added items
- Number of updated cached items
- Refresh errors, if any
If a refresh fails but older data exists, cached posts remain available.
The project intentionally has a minimal structure:
xsukax-X-RSS-Generator/
├── index.php
├── README.md
├── LICENSE
└── .xsukax-x-rss.sqlite # Generated automatically at runtime
Recommended optional .gitignore:
.xsukax-x-rss.sqlite
.xsukax-x-rss.sqlite-journal
*.log
The generated SQLite database should not be committed to Git.
The single application file contains:
Configuration
│
├── Generic helpers and validation
├── Browser/RSS content-type handling
├── SQLite database initialization
├── Per-IP rate limiting
├── HTTPS profile fetching
├── CSS-selector-to-XPath conversion
├── X HTML parsing
├── Post and image extraction
├── Timestamp detection
├── Cache management
├── Post de-duplication
├── RSS 2.0 generation
├── GUI session handling
├── CSRF protection
├── Security headers
├── Web interface rendering
└── Request router
This architecture makes deployment straightforward and avoids framework scaffolding.
The application automatically creates:
.xsukax-x-rss.sqlite
inside the application directory.
The database contains three main tables:
Stores per-profile metadata such as:
- Username
- Last fetch attempt
- Last successful fetch
- Last fetch error
- HTTP ETag
- HTTP Last-Modified value
- Last update time
Stores cached X posts:
- Post ID
- Username
- Title
- Link
- Content
- Publication date
- Fetch timestamp
- Source HTML fragment
Stores temporary per-IP request counters used by the built-in rate limiter.
The default cache lifetime is:
300 seconds
or:
5 minutes
During that period, repeated feed requests use cached content instead of repeatedly fetching the X profile.
After expiration, the application attempts to refresh the source.
When available, upstream HTTP validators are used:
If-None-Match
If-Modified-Since
If X responds with:
304 Not Modified
the existing cache remains valid without reparsing identical content.
The RSS feed itself also receives an ETag calculated from feed state.
RSS readers sending:
If-None-Match: "..."can receive:
HTTP/1.1 304 Not Modifiedinstead of downloading the complete feed again.
A simplified Nginx configuration might look like:
server {
listen 80;
server_name rss.example.com;
root /var/www/xrss;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
}
# Never expose SQLite files.
location ~* \.(sqlite|sqlite3|db)(-journal)?$ {
deny all;
return 404;
}
# Protect hidden files while allowing ACME challenges.
location ~ /\.(?!well-known).* {
deny all;
return 404;
}
}Adjust the PHP-FPM socket for your installed PHP version.
For production, add TLS using your preferred certificate provider.
When using Apache, make sure the SQLite database cannot be downloaded.
An .htaccess or VirtualHost rule can include:
<FilesMatch "\.(sqlite|sqlite3|db)(-journal)?$">
Require all denied
</FilesMatch>The application database contains cached source content and request metadata and should never be publicly downloadable.
The application's rate limiting intentionally uses PHP's REMOTE_ADDR and does not automatically trust arbitrary X-Forwarded-For values.
This avoids IP spoofing through untrusted proxy headers.
If the application runs behind a trusted reverse proxy, configure the proxy/web server's real-IP mechanism so PHP receives the correct trusted client address.
Do not modify the application to blindly trust user-controlled X-Forwarded-For headers.
Security reports are welcome and should be handled responsibly.
The project includes several defensive measures:
X usernames are restricted to:
letters
digits
underscores
Feed limits must be integers between:
1 and 100
Database operations use PDO prepared statements where applicable.
The feed limit is validated and converted to an integer before being incorporated into the SQLite LIMIT clause.
GUI POST actions include randomly generated CSRF tokens.
Tokens are compared using:
hash_equals()to prevent timing-sensitive comparisons.
GUI sessions use:
- HTTP-only cookies
SameSite=Lax- Secure cookies when HTTPS is detected
The GUI sends headers including:
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer
X-Frame-Options: DENY
Content-Security-Policy: ...
Cache-Control: no-storeHTTPS requests use TLS certificate and hostname verification.
HTML parsing uses libxml with network access disabled for parser-triggered external resources.
When the SQLite file is created, the application attempts to apply:
0600
permissions.
Web-server-level protection is still strongly recommended.
Before exposing the generator publicly:
- Use a currently supported PHP version.
- Enable HTTPS.
- Keep PHP and system packages updated.
- Keep
display_errorsdisabled. - Enable PHP error logging.
- Block direct HTTP access to SQLite files.
- Do not commit
.xsukax-x-rss.sqliteto Git. - Restrict application directory permissions.
- Allow only the PHP/web-server user to modify runtime data.
- Keep the default rate limiter enabled.
- Configure trusted proxy IP handling correctly.
- Monitor PHP and web-server error logs.
- Review parser selectors after upstream X frontend changes.
- Back up the SQLite database if cached feed history is important.
Please do not publicly disclose exploitable security vulnerabilities in a normal GitHub issue.
Preferred reporting method:
-
Use GitHub's Security Advisories / private vulnerability reporting feature for this repository, if available.
-
Include:
- Affected version or commit
- Description of the vulnerability
- Reproduction steps
- Potential impact
- Suggested mitigation, if known
-
Allow reasonable time for investigation and remediation before public disclosure.
If private vulnerability reporting is not available, open a minimal issue requesting a private communication channel without publishing exploit details.
Install SQLite support.
Debian / Ubuntu:
sudo apt install php-sqlite3Then restart PHP-FPM or Apache.
Install PHP XML support:
sudo apt install php-xmlRestart PHP afterward.
Locate the active PHP configuration:
php --iniSet:
allow_url_fopen = OnRestart the relevant PHP service.
Ensure the PHP process can write to the application directory.
Check:
ls -ld .and identify the PHP-FPM user:
ps aux | grep php-fpmThen correct ownership or permissions appropriately.
Possible causes include:
- X changed its HTML structure.
- X returned a different page layout.
- The profile does not expose posts publicly.
- X blocked or challenged the server IP.
- The profile does not exist.
- Network access to X failed.
- Cached data does not yet exist.
Check the PHP error log and application refresh message.
The application may report an error such as:
X returned HTTP 403
or:
X returned HTTP 429
This originates from the upstream X service.
Possible causes include:
- Network restrictions
- Temporary blocking
- Rate limiting
- Anti-automation measures
- Changed access behavior
The generator does not attempt to bypass X access controls.
This may be normal.
Browsers and RSS readers interpret XML and RSS MIME types differently. Firefox and Safari in particular have changed their built-in RSS behavior over time.
The application contains browser-specific handling intended to make top-level XML viewing more convenient while preserving the correct RSS content type for feed clients.
Only supported X-hosted post/card image URLs are intentionally included.
Profile avatars, emoji assets, and unrelated third-party image URLs are excluded.
If X changes its media structure, image extraction logic may require an update.
Because this project works from public HTML rather than an official API, several limitations should be understood.
The parser depends on elements available in X's public HTML.
A significant frontend change can require selector updates.
X may apply:
- Rate limits
- Geographic restrictions
- Authentication requirements
- Bot detection
- Temporary access restrictions
The application does not attempt to circumvent such controls.
The project is intended for information that is already publicly accessible.
It does not provide access to:
- Private accounts
- Protected posts
- Direct messages
- Authenticated account data
The generator is focused on converting publicly available profile posts into RSS. It is not intended to reproduce the full functionality of the official X API.
Contributions are welcome.
Bug fixes, compatibility improvements, documentation improvements, parser updates, security hardening, and performance enhancements are all encouraged.
Use GitHub's Fork button.
git clone https://github.com/YOUR-USERNAME/xsukax-X-RSS-Generator.git
cd xsukax-X-RSS-GeneratorFor a feature:
git checkout -b feature/my-featureFor a bug fix:
git checkout -b fix/parser-problemKeep changes:
- Focused
- Readable
- Backward compatible when practical
- Consistent with the existing single-file architecture
php -l index.phpVerify:
- Normal GUI loading
- CSRF-protected forms
- Direct RSS generation
- Cache hits
- Forced cache refreshes
- Invalid usernames
- Invalid limits
- RSS XML validity
- SQLite initialization
- HTTP error handling
- Mobile layout
Use meaningful commit messages.
Example:
git commit -m "Fix X post image extraction"git push origin fix/parser-problemDescribe:
- What changed
- Why it changed
- How it was tested
- Any compatibility considerations
Contributors should:
- Use PHP strict typing where appropriate.
- Follow the existing code style.
- Prefer PSR-12-compatible formatting.
- Validate all external input.
- Escape HTML output.
- Use parameterized database operations.
- Avoid introducing unnecessary dependencies.
- Keep X-specific selectors centralized.
- Preserve RSS 2.0 compatibility.
- Preserve the project's lightweight architecture.
- Document configuration changes.
- Avoid suppressing security-related failures.
- Never commit generated SQLite data.
Large architectural changes should be discussed in an issue before implementation.
This project is licensed under the:
GNU General Public License v3.0 (GPL-3.0)
You are free to:
- Use the software
- Study the software
- Modify the software
- Distribute copies
- Distribute modified versions
subject to the terms and conditions of the GPL-3.0 license.
Modified or redistributed versions must comply with the GPL's source-code and licensing requirements.
See:
LICENSE
for the complete license text.
SPDX identifier:
GPL-3.0-only
xsukax
GitHub:
https://github.com/xsukax
Repository:
https://github.com/xsukax/xsukax-X-RSS-Generator
The project is maintained as part of the xsukax collection of lightweight, self-hosted, and open-source utilities.
For bug reports, feature requests, compatibility problems, or general questions, use the repository's GitHub Issues page:
https://github.com/xsukax/xsukax-X-RSS-Generator/issues
Before opening an issue:
- Confirm you are using a supported PHP version.
- Confirm
pdo_sqlite,dom, andlibxmlare enabled. - Confirm
allow_url_fopenis enabled. - Test whether the server itself can reach
https://x.com/. - Check the PHP error log.
- Search existing issues for similar reports.
When reporting a problem, include:
PHP version:
Operating system:
Web server:
PHP SAPI:
Relevant error:
Steps to reproduce:
Expected behavior:
Actual behavior:
Do not post confidential server information, credentials, session cookies, or other secrets.
This project is an independent open-source utility and is not affiliated with, endorsed by, sponsored by, or operated by X Corp.
"X", "Twitter", and related names and trademarks belong to their respective owners.
The project accesses publicly available web content. Users are responsible for ensuring that their deployment and use of the software complies with:
- Applicable law
- X's applicable terms and policies
- Hosting-provider rules
- Network-access restrictions
- Content and privacy requirements in their jurisdiction
The software does not attempt to bypass authentication, access private accounts, or defeat technical access controls.
Because X can change its frontend implementation at any time, uninterrupted compatibility cannot be guaranteed.
If you find xsukax X RSS Generator useful:
- Star the repository
- Report bugs
- Suggest improvements
- Submit pull requests
- Share the project with other RSS and self-hosting users
Repository:
https://github.com/xsukax/xsukax-X-RSS-Generator
xsukax X RSS Generator Public X profiles → clean, self-hosted RSS feeds.