Spaces:
Sleeping
Sleeping
Update primitives/tools.py
Browse files- primitives/tools.py +4 -4
primitives/tools.py
CHANGED
|
@@ -98,9 +98,9 @@ async def cricket_source(mode: Literal["live", "upcoming"], want: Literal["text"
|
|
| 98 |
text = container.get_text(separator=" ", strip= True)
|
| 99 |
return json.dumps({f"{mode} details": str(text)})
|
| 100 |
elif mode == 'live' and want == 'herf':
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
return json.dumps({"
|
| 104 |
else:
|
| 105 |
return json.dumps({"error": f"Not Implemented for {mode} with {want}"})
|
| 106 |
|
|
@@ -119,7 +119,7 @@ async def fetch_cricket_details(mode: Literal["live", "upcoming"])-> str:
|
|
| 119 |
|
| 120 |
|
| 121 |
async def live_cricket_scorecard_href()-> str:
|
| 122 |
-
"""String of comma separated anchor tags with
|
| 123 |
response = await cricket_source('live', 'herf')
|
| 124 |
return response
|
| 125 |
|
|
|
|
| 98 |
text = container.get_text(separator=" ", strip= True)
|
| 99 |
return json.dumps({f"{mode} details": str(text)})
|
| 100 |
elif mode == 'live' and want == 'herf':
|
| 101 |
+
hrefs_list = container.find_all("a", class_ = "cb-text-link cb-mtch-lnks")
|
| 102 |
+
hrefs_string = ",".join(str(tag) for tag in herfs_list)
|
| 103 |
+
return json.dumps({"hrefs_strings": herfs_string})
|
| 104 |
else:
|
| 105 |
return json.dumps({"error": f"Not Implemented for {mode} with {want}"})
|
| 106 |
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
async def live_cricket_scorecard_href()-> str:
|
| 122 |
+
"""String of comma separated anchor tags with herf attributes that pointing to live cricket scorecards """
|
| 123 |
response = await cricket_source('live', 'herf')
|
| 124 |
return response
|
| 125 |
|