Yudaotor / EsportsHelper

通过selenium模拟浏览器来自动观看电竞比赛获取电竞典藏罐,当没有比赛时智能休眠.(Automatically watch e-sports games through undetected_chromedriver to farm esports capsule, when there is no match intelligent sleep.)
MIT License
201 stars 20 forks source link

Updated content-type check. This change addresses the issue where 'watchHour' is not populated. #129

Closed ReformedDoge closed 3 months ago

ReformedDoge commented 6 months ago

Description: "/stats?sport=lol" content-type changed to text/plain for some reason. This caused 'watchHour' to not be populated as expected. By updating the content-type check in the condition to include both "application/json" and "text/plain" packet types, this issue is resolved.

Affected file: NetworkHandler.py

ReformedDoge commented 6 months ago

@Yudaotor, Screenshot_1

they reverted v1/history/stats?sport=lol back to "application/json". We can keep the change as is just in case they alter it again.

Regarding the code snippet:

if packetType != "application/json" and packetType != "text/plain":
                continue

This is my third time skimming through the code, so please excuse my limited knowledge. Is the check even necessary? It seems to work fine without it, as the try block already handles the checking for the paths

Yudaotor commented 6 months ago

@Yudaotor, Screenshot_1

they reverted v1/history/stats?sport=lol back to "application/json". We can keep the change as is just in case they alter it again.

Regarding the code snippet:

if packetType != "application/json" and packetType != "text/plain":
                continue

This is my third time skimming through the code, so please excuse my limited knowledge. Is the check even necessary? It seems to work fine without it, as the try block already handles the checking for the paths

its unnecessary.just filter some.ok then.I will merge this when next update.