diff --git a/README.md b/README.md
index 8049a11..2d1f3a1 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,15 @@ Least-favourite twitch streamers here
## Change Log
+### 1.10.0
+#### Changed
+- Refresh website design
+
+### 1.9.1
+#### Fixed
+- Server does not fail when processing API response withour `cursor` field.
+- String formatting for older python3 versions.
+
### 1.9
#### Fixed
- Char escaping and various typos.
diff --git a/main.py b/main.py
index 485fa37..bee436d 100755
--- a/main.py
+++ b/main.py
@@ -4,7 +4,7 @@
import cherrypy
from twitch import TwitchClient
-ver = '1.9.0'
+ver = '1.10.0'
class FleastServer(object):
@@ -90,7 +90,7 @@ class FleastServer(object):
s['thumbnail_url'].format(width=320, height=180),
self.to_html(s['title']),
s['user_name'],
- s['viewer_count']) + '\n'
+ s['viewer_count'])
return self.templ_main.format(_stream_num_=len(data['streams']),
_game_name_=game,
diff --git a/twitch.py b/twitch.py
index d1e27aa..194b2fb 100644
--- a/twitch.py
+++ b/twitch.py
@@ -66,7 +66,7 @@ class TwitchClient:
r = requests.get(base, headers=header).json()
error_message = r.get("error", "")
if len(error_message) > 0:
- cherrypy.log(f'Request: fail with error "{error_message}"')
+ cherrypy.log('Request: fail with error "%s"' % error_message)
r = None
else:
cherrypy.log('Request: OK')
@@ -143,16 +143,37 @@ class TwitchClient:
q_template = "{}/streams?language={}&first={}&after={}{}"
game_id = ''
- irl_ids = ["509660", "509673", "509667", "509669", "509670", "509658",
- "509672", "509671", "509664", "509663", "417752", "509659"]
+ """
+ 417752: Talk Shows & Podcasts
+ 509658: Just Chatting
+ 509659: ASMR
+ 509660: Art
+ 509663: Special Events
+ 509664: Tabletop RPGs
+ 509667: Food & Drink
+ 509669: Beauty & Body Art
+ 509670: Science & Technology
+ 509671: Fitness & Health [exclude]
+ 509672: Travel & Outdoors
+ 509673: Makers & Crafting
+ 515214: Politics [exclude]
+ 518203: Sports
+ 116747788: Pools, Hot Tubs, and Beaches
+ 272263131: Animals, Aquariums, and Zoos [exclude]
+ 1469308723: Software and Game Development
+ """
+ irl_ids = ["417752", "509658", "509659", "509660", "509663", "509664",
+ "509667", "509669", "509670", "509672", "509673", "518203",
+ "116747788", "1469308723"]
for irl_id in irl_ids:
game_id += '&game_id={}'.format(irl_id)
result = {'_total': 0, 'streams': []}
data = self.do_q_auth_v6(init_q_template.format(base, lang, 100, game_id), header)
- result['streams'].extend(data['data'])
while len(data.get('data', [])) > 0: # there must be non zero value, but search is kinda broken now
result['streams'].extend(data['data'])
+ if data['pagination'].get("cursor", None) is None: # sometimes server return results without cursor
+ break
data = self.do_q_auth_v6(q_template.format(base, lang, 100, data['pagination']['cursor'], game_id), header)
return self.unique_streams_v6(result)
diff --git a/web/fl.html b/web/fl.html
index e554367..eaf53e7 100644
--- a/web/fl.html
+++ b/web/fl.html
@@ -3,64 +3,101 @@
FLeast
-
+
-
-
-
-
FLeast - your least favourite streamers here
-
-
-
-
-
Usage:
-
- Write the name of the game and select the language.
- The name must _exactly_ match the name of the game on twitch.tv
- i.e. csgo must be "Counter-Strike: Global Offensive".
- IRL is back! Sort of.
- You can type IRL in game field and it will output streams from
- Just Chatting, Travel & Outdoors, etc...
-
-
-
+
+
+
+
+
+
Fleast — find new favourite small streamer
+
- Developed by Alex Vanin | twitter |
- github
- Version: {_version_}
+ Search streams by specifying category from twitch.tv and the
+ language of the stream. Streams will be sorted by ascending order.
-
+
+ The category must be specified by exact name. For example,
+ if you are looking for Counter-Strike, then you should write
+ Counter-Strike: Global Offensive.
+
+
+ You can use IRL like in good old days. The output will
+ combine Just Chatting, Travel & Outdoors, and other categories.
+
- Write the name of the game and select the language.
- The name must _exactly_ match the name of the game on twitch.tv
- i.e. csgo must be "Counter-Strike: Global Offensive".
- You can type IRL in game field and it will output streams from
- Just Chatting, Travel & Outdoors, etc...
-