Browse Source

Removed environment var

main
Yigit Colakoglu 2 years ago
parent
commit
b91f60783c
3 changed files with 18 additions and 21 deletions
  1. +14
    -2
      README.md
  2. +0
    -16
      SetUp.md
  3. +4
    -3
      api/book.py

+ 14
- 2
README.md View File

@ -1,4 +1,4 @@
## Book status for profile README
# Book status for profile README
This project provides a badge for sharing your current book in your github profile.
@ -9,4 +9,16 @@ This project provides a badge for sharing your current book in your github profi
It is heavily inspired by [spotify-readme](https://github.com/novatorem/spotify-readme).
Install instructions are available [here](https://github.com/thefr1nge/goodreads-readme/blob/master/SetUp.md).
## Set Up Guide
- Go to your goodreads profile (on your PC).
- Next to "Your recent updates" there is an hyperlink called **rss**
- Note down the 8 digit integer in the ending of the URL's path section
- Add the following into the readme file, replacing the parameter with the id
you noted down.
```
<h3 align="left">I am currently reading:</h3>
<a href="<Your Profile URL>"><img src="https://goodreads-readme.vercel.app/api/book?id=<ID you noted down>" alt="GoodReads reading" width="350" /></a>
```

+ 0
- 16
SetUp.md View File

@ -1,16 +0,0 @@
# Set Up Guide
You must fork this repository first to create a Vercel project.
## Goodreads
- Go to your goodreads profile (on your PC).
- Next to "Your recent updates" there is an hyperlink called **rss**
## Vercel
* Register on [Vercel](https://vercel.com/)
* Create project linked to your github repo
* Add System Variable:
* `https://vercel.com/<YourName>/<ProjectName>/settings/environment-variables`
* `GOODREADS_RSS_URL`
* Deploy!

+ 4
- 3
api/book.py View File

@ -1,4 +1,4 @@
from flask import Flask, Response, jsonify, render_template
from flask import Flask, Response, jsonify, render_template, request
from base64 import b64encode
import feedparser
import re
@ -11,7 +11,6 @@ import json
import os
import random
GOODREADS_RSS_URL = os.getenv("GOODREADS_RSS_URL")
PROGRESS_REGEX = r".*<img .* alt=\"([^\"]*) by ([^\"]*)\".*src=\"([^\"]*)\".*.* is on page ([0-9]*) of ([0-9]*) of <a.*"
READ_REGEX = r".*<img .* alt=\"([^\"]*) by ([^\"]*)\".*src=\"([^\"]*)\".*finished reading.*"
@ -40,7 +39,9 @@ app = Flask(__name__)
@app.route("/", defaults={"path": ""})
@app.route("/<path:path>")
def last_activity(path):
activityFeed = feedparser.parse(GOODREADS_RSS_URL)
goodread_rss_url = f'https://www.goodreads.com/user/updates_rss/{request.args.get("id")}'
print(goodread_rss_url)
activityFeed = feedparser.parse(goodread_rss_url)
data = ""
entries = activityFeed.entries
pr = re.compile(PROGRESS_REGEX)


Loading…
Cancel
Save