You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/python-test-release.yml
+2-9Lines changed: 2 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,8 @@
1
-
# This workflows will upload a Python Package using Twine when a release is created
2
-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
1
+
# This workflows will test the released version of the API
@@ -78,14 +80,13 @@ if results_list is not None and len(results_list) > 0:
78
80
Once done, "best_element" will contain the best game found in the research.
79
81
Every entry in the list (if not None in case of errors) is an object of type: [HowLongToBeatEntry](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py).
80
82
81
-
### Alternative search (by id)
83
+
### Alternative search (by ID)
82
84
83
-
If you prefer, you can get a game by id, this can be useful if you already have the game's howlongtobeat-id.
84
-
Unluckily, is not worth to make a parser for the single-page game info, because is a user page that can change frequently and full of HTML.
85
+
If you prefer, you can get a game by ID, this can be useful if you already have the game's howlongtobeat-id (the ID is the number in the URL, for example in [https://howlongtobeat.com/game/7231]([hello](https://howlongtobeat.com/game/7231)) the ID is 7231).
85
86
86
-
To avoid a new parser, the search by id use a first request to get the game title, and then use the standard search, filtering the results and returning the unique game with that id.
87
+
To avoid a new parser, the search by ID use a first request to get the game title, and then use the standard search with that title, filtering the results and returning the unique game with that ID.
87
88
88
-
Remember that it could be a bit slower, but you avoid searching the game in the array.
89
+
Remember that it could be a bit slower, but you avoid searching the game in the array by similarity.
89
90
90
91
Here's the example:
91
92
@@ -102,21 +103,19 @@ result = await HowLongToBeat().async_search_from_id(123456)
102
103
This call will return an unique [HowLongToBeatEntry](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py) or None in case of errors.
103
104
104
105
### DLC search
105
-
Apparently in the default search DLCs don't appear (see: [#6](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/issues/6)). An `enum` has been added:
106
+
107
+
An `enum` has been added to have a filter in the search:
106
108
107
109
```python
108
-
SearchModifiers.NONE
109
-
SearchModifiers.INCLUDE_DLC# Probably unnecessary
110
+
SearchModifiers.NONE# default
110
111
SearchModifiers.ISOLATE_DLC
111
112
SearchModifiers.HIDE_DLC
112
113
```
113
114
114
-
This optional parameter allow you to specify in the search if you want the default search (no DLCs), to INCLUDE DLCs along with games, or to ISOLATE DLCs (show only DLCs in the result).
115
-
116
-
**Update January 2020**: Apparently HowLongToBeat re-added DLCs in the default search, so `SearchModifiers.INCLUDE_DLC` should no longer be necessary. It will remain for completeness and compatibility.
117
-
A new option has been added instead: `SearchModifiers.HIDE_DLC`, that is basically the opposite of including DLCs.
115
+
This optional parameter allow you to specify in the search if you want the default search (with DLCs), to HIDE DLCs and only show games, or to ISOLATE DLCs (show only DLCs).
118
116
119
117
### Results auto-filter
118
+
120
119
To ignore games with a very different name, the standard search automatically filter results with a game name that has a similarity with the given name > than `0.4`, not adding the others to the result list.
121
120
If you want all the results, or you want to change this value, you can put a parameter in the constructor:
122
121
@@ -132,21 +131,21 @@ Also remember that by default the similarity check **is case-sensitive** between
**Remember** that, when searching by ID, the similarity value and the case-sensitive bool are ignored.
134
+
**Remember** that, when searching by ID, the similarity value and the case-sensitive bool are **ignored**.
136
135
137
136
### Reading an entry
138
137
139
-
An entry is made of few values, you can check them [in the Entry class file](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py)
138
+
An entry is made of few values, you can check them [in the Entry class file](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py). It also include the full JSON of values (already converted to Python dict) received from HLTB.
140
139
141
140
## Issues, Questions & Discussions
142
141
143
142
If you found a bug report it as soon as you can creating an [issue](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/issues/new), the code may not be perfect.
144
143
145
-
If you need any new feature, or want to discuss the current implementation/features, consider opening a [discussion](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/discussions).
144
+
If you need any new feature, or want to discuss the current implementation/features, consider opening a [discussion](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/discussions) or even propose a change with a [Pull Request](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/pulls).
The return of that function is a **list** of possible games, or **None** in case you passed an invalid "game name" as parameter or if there was an error in the request.
71
+
72
+
If the list **is not None** you should choose the best entry checking the Similarity value with the original name, example:
Once done, "best_element" will contain the best game found in the research.
81
+
Every entry in the list (if not None in case of errors) is an object of type: [HowLongToBeatEntry](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py).
82
+
83
+
### Alternative search (by ID)
84
+
85
+
If you prefer, you can get a game by ID, this can be useful if you already have the game's howlongtobeat-id (the ID is the number in the URL, for example in [https://howlongtobeat.com/game/7231]([hello](https://howlongtobeat.com/game/7231)) the ID is 7231).
86
+
87
+
To avoid a new parser, the search by ID use a first request to get the game title, and then use the standard search with that title, filtering the results and returning the unique game with that ID.
88
+
89
+
Remember that it could be a bit slower, but you avoid searching the game in the array by similarity.
90
+
91
+
Here's the example:
92
+
93
+
```python
94
+
result = HowLongToBeat().search_from_id(123456)
95
+
```
96
+
97
+
or, if you prefer using async:
98
+
99
+
```python
100
+
result =await HowLongToBeat().async_search_from_id(123456)
101
+
```
102
+
103
+
This call will return an unique [HowLongToBeatEntry](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py) or None in case of errors.
104
+
105
+
### DLC search
106
+
107
+
An `enum` has been added to have a filter in the search:
108
+
109
+
```python
110
+
SearchModifiers.NONE# default
111
+
SearchModifiers.ISOLATE_DLC
112
+
SearchModifiers.HIDE_DLC
113
+
```
114
+
115
+
This optional parameter allow you to specify in the search if you want the default search (with DLCs), to HIDE DLCs and only show games, or to ISOLATE DLCs (show only DLCs).
116
+
117
+
### Results auto-filter
118
+
119
+
To ignore games with a very different name, the standard search automatically filter results with a game name that has a similarity with the given name > than `0.4`, not adding the others to the result list.
120
+
If you want all the results, or you want to change this value, you can put a parameter in the constructor:
putting `0.0` (or just `0`) will return all the found games, otherwise you can write another (`float`) number between 0...1 to set a new filter, such as `0.7`.
127
+
128
+
Also remember that by default the similarity check **is case-sensitive** between the name given and the name found, if you want to ignore the case you can use:
**Remember** that, when searching by ID, the similarity value and the case-sensitive bool are **ignored**.
135
+
136
+
### Reading an entry
137
+
138
+
An entry is made of few values, you can check them [in the Entry class file](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/blob/master/howlongtobeatpy/howlongtobeatpy/HowLongToBeatEntry.py). It also include the full JSON of values (already converted to Python dict) received from HLTB.
139
+
140
+
## Issues, Questions & Discussions
141
+
142
+
If you found a bug report it as soon as you can creating an [issue](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/issues/new), the code may not be perfect.
143
+
144
+
If you need any new feature, or want to discuss the current implementation/features, consider opening a [discussion](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/discussions) or even propose a change with a [Pull Request](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/pulls).
145
+
146
+
## Authors
147
+
148
+
***ScrappyCocco** - Thank you for using my API
149
+
150
+
## License
151
+
152
+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
0 commit comments