Open kanglinyao opened 1 year ago
Well, I have observed that during certain times of the day, Bible Gateway's JSON API would 'go down', mostly in evening (GMT+8). Now (8 a.m. GMT+8) it works perfectly on my machine.
Let's see if running the following in the python console works.
import requests
requests.get('https://www.biblegateway.com/votd/get/?format=json').content
Does it print something likeb'{"votd":{"text":"“Let the peace of Christ rule in your hearts, since as members of one body you were called to peace. And be thankful.”","content":"Let the peace of Christ rule in your hearts, since as members of one body you were called to peace. And be thankful.","display_ref":"Colossians 3:15","reference":"Colossians 3:15","permalink":"https:\\/\\/www.biblegateway.com\\/passage\\/?search=Colossians%203:15&version=NIV","copyright":" ","copyrightlink":"https:\\/\\/www.biblegateway.com\\/versions\\/index.php?action=getVersionInfo&vid=31&lang=2","audiolink":"https:\\/\\/www.biblegateway.com\\/audio\\/mclean\\/niv\\/Col.3.15","day":"22","month":"11","year":"2022","version":"New International Version","version_id":"NIV","merchandising":""}}'
?
Yes, it printed the verse in console, but the plugin still gets no verses for variety.
This is what the verse.py contains: response = json.loads(requests.get('https://www.biblegateway.com/votd/get/?format=json&version=' + version).content) return [{'quote': html.parser.HTMLParser().unescape(response['votd']['text']), 'author': response['votd']['display_ref'], 'sourceName': None
I notice the forma=json&version, which is different from the
import requests
requests.get('https://www.biblegateway.com/votd/get/?format=json').content
Then I believe maybe it's a problem with variety. I cannot reproduce the bug and I don't know where variety's logs are stored. Perhaps you may open an issue at variety?
I notice the forma=json&version, which is different from the
Without the version
query parameter, Bible Gateway defaults to NIV. For instance, if you specify the version as RCU17SS:
>>> requests.get('https://www.biblegateway.com/votd/get/?format=json&version=RCU17SS').content
b'{"votd":{"text":"“[基督里的丰盛] 既然你们接受了主基督耶稣,就要靠着他而生活, 照着你们所领受的教导,在他里面生根建造,信心坚固,充满着感谢的心。”","content":"<h3>基督里的丰盛<\\/h3> 既然你们接受了主基督耶稣,就要靠着他而生活, 照着你们所领受的教导,在他里面生根建造,信心坚固,充满着感谢的心。","display_ref":"\\u6b4c\\u7f57\\u897f\\u4e66 2:6-7","reference":"Colossians 2:6-7","permalink":"https:\\/\\/www.biblegateway.com\\/passage\\/?search=Colossians%202:6-7&version=RCU17SS","copyright":" ","copyrightlink":"https:\\/\\/www.biblegateway.com\\/versions\\/index.php?action=getVersionInfo&vid=258&lang=2","audiolink":"","day":"24","month":"11","year":"2022","version":"Revised Chinese Union Version (Simplified Script) Shen Edition","version_id":"RCU17SS","merchandising":""}}'
Well, the same bug now occurs on my machine. And other variety plugins (the built-in quotes plugins) work perfectly. So I think there's indeed something wrong with my script. But I'm very busy now and hope that I can look into the problem after 14 Jan. Sorry for the inconvenience.
@kanglinyao you could check your python if it's 3.9, after downgrade to 3.8 will fix it.
@kanglinyao Hello, today the script completely broke down on my machine too. And after digging through the source code of variety, I found that it set an upper limit on the length of the quote. So when I set quotes_max_length
to 4096
in ~/.config/variety/variety.conf
, it works again.
I will include a note about this in the README shortly.
It seems the script stopped working.