Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Samathingamajig/twitch-sub-pricing
Finds where the cheapest Twitch subs can be acquired
https://github.com/Samathingamajig/twitch-sub-pricing
Last synced: about 1 month ago
JSON representation
Finds where the cheapest Twitch subs can be acquired
- Host: GitHub
- URL: https://github.com/Samathingamajig/twitch-sub-pricing
- Owner: Samathingamajig
- License: mit
- Created: 2022-10-22T09:10:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-22T09:30:47.000Z (about 2 years ago)
- Last Synced: 2024-08-01T21:58:35.112Z (5 months ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- starred - Samathingamajig/twitch-sub-pricing - Finds where the cheapest Twitch subs can be acquired (Python)
README
# Twitch Sub Pricing
Twitch doesn't charge the same amount of money per sub in each country, but they don't publish them all in the same currency so to determine the cheapest prices, I scraped the data from Twitch and a currency converter "api" to normalize the prices to USD.
It's against the TOS to lie about your location to get cheaper prices, so this is for educational purposes only. If you want to move to any of the cheap countries, that's cool too.
## How to use
1. Clone the repo
2. Run `pip install -r requirements.txt` (wherever your pip is, such as `py -3 -m pip install -r requirements.txt` on Windows)
3. Run `python main.py`## Results (as of 2022-10-22)
### The 3 Cheapest Countries
| Country | Price (USD) |
| :-----: | :---------: |
| Turkey | $0.53 |
| Ukraine | $0.97 |
| India | $1.33 |### The 3 Most Expensive Countries
| Country | Price (USD) |
| :---------: | :---------: |
| New Zealand | $4.59 |
| Kuwait | $4.81 |
| Australia | $5.01 |\* Does not include North American countries
## Implementation Details
- I used [pyppeteer](https://pypi.org/project/pyppeteer/) to scrape the data from Twitch, since it's a single page app and I didn't want to deal with the API (loads the data from a GraphQL API with weird permissions, not server rendered).
- I used [beautifulsoup4](https://pypi.org/project/beautifulsoup4/) to parse the HTML.
- I used asyncio with [aiohttp](https://pypi.org/project/aiohttp/) to make the requests to the currency converter API in parallel (and also asyncio was used for pyppeteer).
- Outputs to a CSV file (`./prices.csv`).