Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,13 +47,15 @@ async def linkedin_post_details(post_id: str):
|
|
47 |
except Exception as e:
|
48 |
continue
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
reactions = 0
|
56 |
-
reactions = spans[0].text.strip()
|
57 |
|
58 |
try:
|
59 |
comments = soup.find("a", {"data-test-id": "social-actions__comments"}).get(
|
@@ -65,9 +67,9 @@ async def linkedin_post_details(post_id: str):
|
|
65 |
return {
|
66 |
"insights": {
|
67 |
"likeCount": None,
|
68 |
-
"commentCount": comments,
|
69 |
"shareCount": None,
|
70 |
-
"reactionCount": reactions,
|
71 |
"reactions": [],
|
72 |
},
|
73 |
"description": desc,
|
|
|
47 |
except Exception as e:
|
48 |
continue
|
49 |
|
50 |
+
|
51 |
+
spans = soup.find_all(
|
52 |
+
"span", {"data-test-id": "social-actions__reaction-count"}
|
53 |
+
)
|
54 |
+
|
55 |
+
if spans:
|
56 |
+
reactions = spans[0].text.strip()
|
57 |
+
else:
|
58 |
reactions = 0
|
|
|
59 |
|
60 |
try:
|
61 |
comments = soup.find("a", {"data-test-id": "social-actions__comments"}).get(
|
|
|
67 |
return {
|
68 |
"insights": {
|
69 |
"likeCount": None,
|
70 |
+
"commentCount": int(comments.replace(",", "")),
|
71 |
"shareCount": None,
|
72 |
+
"reactionCount": int(reactions.replace(",", "")),
|
73 |
"reactions": [],
|
74 |
},
|
75 |
"description": desc,
|