Skip to content

ppati000/jodelstats

Repository files navigation

Jodel Stats

This is the source code for jodelstats.com, which is a small web app that shows the most popular posts on Jodel in Germany everywhere in the world.

How does this web app work?

This web app communicates with the Jodel servers to obtain the most popular posts in various cities. The city names and coordinates are saved in the database. The front end is just some Bootstrap magic.

I want feature X!

If you have any suggestions or if you would like to reach out to me, feel free to message me on Twitter or send me an e-mail.

Can I contribute to this thing?

Yes, of course! The process is as follows:

  1. Fork this repository
  2. Push your changes
  3. Create a pull request

How to set up this project on your machine

Some steps of setting this project up on your machine are quite complicated, so I'll try to be very verbose.

Prerequisities: You need to have Ruby on Rails installed on your machine. (OS X or Linux). Provided that this is fulfilled, here's what you need to get started:

  1. Clone the project using git clone git@github.com:ppati000/jodelstats && cd jodelstats
  2. Run bundle install --without production
  3. Tun bundle exec rake db:migrate
  4. Start the server using rails s
  5. Next, we need to get an access token as well as a refresh token for Jodel's API. I have found no programmatic way to create new Jodel accounts yet as they seem to use HMAC authorization for that. Note: This is a complicated step, but as soon as this is done the web app will fetch new API keys automatically before they expire.
  6. For Pros: See section below (Obtaining API Tokens)
  7. For everyone who does not have that much time to waste: Just send me an email and I'll take care of it.
  8. Run rails c to fire up the rails console
  9. Run ApiKey.create(token: "YOUR_ACCESS_TOKEN", refresh_token: "YOUR_REFRESH_TOKEN", current_client_id: "YOUR_CURRENT_CLIENT_ID", distinct_id: "YOUR_DISTINCT_ID", replacing all the placeholders with the values you obtained in the step before (or the values I sent you)
  10. To see if everything worked, run JodelCityController.update_api_token. The last line of output should be => true. If you get an error instead, at least one value supplied is invalid.
  11. Add a test city: JodelCity.create(name: "Karlsruhe", latitude: "49.01", longitude: "8.34", country: "DE")
  12. Open your browser on http://localhost:3000/ and you should see the test city.
  13. Now you're on your own! Have fun playing around!

Obtaining API Tokens (for Pros)

Obtaining a new Jodel account works as follows (using the iOS Client here). If you do not use the Jodel App on your device, you can skip steps 1 and 2.

  1. Create a backup of your device
  2. Restore your device using iTunes or reset all contents and settings
  3. Download Jodel app
  4. Connect your device to mitmproxy on your computer
  5. Start and set up the app
  6. Kill the app, set your device's date to at least 8 days from now, reopen the jodel app and look for a "refreshToken" request in mitmproxy (if you see two requests, use the second/later one)
  7. Store/write down the following values somewhere. From the request body: current_client_id, distinct_id, refresh_token, and from the response body: access_token
  8. Congratulations! You now have all the data for the Jodel API
  9. Restore your device from backup to get back your old Jodel account :)

Todo

  • Fix API Keys (API Keys are currently invalidated after 1 week, and fetching new API keys needs to be implemented) Edit: The app can now fetch new API keys, but only if a valid API key already exists in the database. You should never use API keys belonging to the same Jodel account for different environments, or else one environment will at some point update the API key, leaving the other environment with the old, now invalid API key.
  • Internationalization (Swedish? French?)
  • Pagination for the front page
  • Make linking to searches possible. As of now, cities you search for become inaccessible after five minutes until you type and search the name again.
  • Make refreshing cities atomic. As of now, all posts of a city are deleted before adding new posts.
  • Anything else you like

About

jodelstats.com: Displays the most popular posts on Jodel (jodel-app.com) using its (private) API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published