diff --git a/LinkedIn/LinkedIn_Get_saved_posts_URL.ipynb b/LinkedIn/LinkedIn_Get_saved_posts_URL.ipynb
new file mode 100644
index 0000000000..fe92949908
--- /dev/null
+++ b/LinkedIn/LinkedIn_Get_saved_posts_URL.ipynb
@@ -0,0 +1,306 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "9a08b929-eb2d-4382-940b-dcc7cc8cf223",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a5b2c509-2c29-49e8-af91-4f3f1e386da3",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "# LinkedIn - Get saved posts URL\n",
+ "
Give Feedback | Bug report"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d77fe283-4edd-42d3-a909-8e207d4b842f",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "**Tags:** #linkedin #naas #posts #saved"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b90f2d91-c886-4e36-8265-b09d06bb1c7f",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "**Author:** [Sohaib Anwaar](https://www.linkedin.com/in/sohaibanwaar/)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6bbf7807-dda4-4b8a-b016-fe258a0fa33f",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "**Last update:** 2024-02-23 (Created: 2024-02-23)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "214749fe-7f0b-4755-b7ea-1d200c234cc6",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "**Description:** This notebook extracts saved posts and articles URL from your LinkedIn."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a1329bea-ad80-4981-874c-8776b11f89a8",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "**References:**\n",
+ "- [Learn how to get your cookies on LinkedIn](https://www.notion.so/LinkedIn-driver-Get-your-cookies-d20a8e7e508e42af8a5b52e33f3dba75)\n",
+ "- [Naas Secret Documentation](https://site.naas.ai/docs/developers/jobs/secret)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "cff349c8-2816-4ae4-9229-027c068eeb51",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "## Input"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "80266a9e-fe54-4f3e-aeb2-01483bbc53f9",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "### Import libraries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "cc038b10-2679-42bc-909e-09a298339df4",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "import naas\n",
+ "import json\n",
+ "import requests"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "30127040-e487-4115-8317-5084823b3a6f",
+ "metadata": {
+ "papermill": {},
+ "tags": [
+ "variables"
+ ]
+ },
+ "source": [
+ "### Setup variables\n",
+ "**Mandatory**\n",
+ "- `li_at`: Cookie used to authenticate Members and API clients. This value will be stored under the secret 'LINKEDIN_LI_AT'.\n",
+ "- `JSESSIONID`: Cookie used for Cross Site Request Forgery (CSRF) protection and URL signature validation. This value will be stored under the secret 'LINKEDIN_JSESSIONID'."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "916a9fe8-c806-4542-94d5-2a7a7e5c8028",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "# Mandatory\n",
+ "li_at = naas.secret.get(\"LINKEDIN_LI_AT\") or \"YOUR_LINKEDIN_LI_AT\"\n",
+ "JSESSIONID = naas.secret.get(\"LINKEDIN_JSESSIONID\") or \"YOUR_LINKEDIN_JSESSIONID\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1b0ae044-cac2-479f-b1fc-a3318696adf5",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "## Model"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "98ed1327-8787-4e28-99e2-2c15fb447298",
+ "metadata": {},
+ "source": [
+ "### Get Saved Posts URL"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "9f05e02c-f9ae-440a-bcc8-047ff0bd5e99",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "def get_saved_posts_and_articles(\n",
+ " li_at,\n",
+ " JSESSIONID\n",
+ "):\n",
+ " # Define headers and cookies\n",
+ " headers = {\n",
+ " \"X-Li-Lang\": \"en_US\",\n",
+ " \"Accept\": \"application/vnd.linkedin.normalized+json+2.1\",\n",
+ " \"Cache-Control\": \"no-cache\",\n",
+ " \"X-Requested-With\": \"XMLHttpRequest\",\n",
+ " \"X-Restli-Protocol-Version\": \"2.0.0\",\n",
+ " \"Csrf-Token\": JSESSIONID\n",
+ " }\n",
+ " cookies = {\n",
+ " \"li_at\": li_at,\n",
+ " \"JSESSIONID\": JSESSIONID\n",
+ " }\n",
+ " # replace this with your url \n",
+ " url = \"https://www.linkedin.com//voyager/api/graphql?variables=(start:0,query:(flagshipSearchIntent:SEARCH_MY_ITEMS_SAVED_POSTS))&queryId=voyagerSearchDashClusters.a6589bc963659630adee73df22e9384c\"\n",
+ " \n",
+ " try:\n",
+ " all_save_urls = []\n",
+ " # Make the request\n",
+ " response = requests.get(url, headers=headers, cookies=cookies)\n",
+ " response.raise_for_status() # Raise an exception for 4xx or 5xx status codes\n",
+ "\n",
+ " # Check the response status code\n",
+ " if response.status_code == 200:\n",
+ " all_data = response.json()\n",
+ " for each in all_data.get('included'):\n",
+ " if each.get('navigationUrl'):\n",
+ " all_save_urls.append(each.get('navigationUrl'))\n",
+ " # Return the urls\n",
+ " return all_save_urls \n",
+ " else:\n",
+ " print(\"Error:\", response.status_code)\n",
+ " return None\n",
+ "\n",
+ " except requests.exceptions.RequestException as e:\n",
+ " print(\"Error:\", e)\n",
+ " print(\"Please provide a new li_at or JSESSIONID as the previous one has expired.\")\n",
+ " return None\n",
+ " \n",
+ "result = get_saved_posts_and_articles(li_at, JSESSIONID)\n",
+ "result"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7c97931b-4ce8-46f9-a70c-45393c5669ee",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "## Output"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "760ec150-d79a-4208-adfe-d0336d443dc8",
+ "metadata": {
+ "papermill": {},
+ "tags": []
+ },
+ "source": [
+ "### Display result"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "18edeb44-7e6c-4ea9-97ea-7581eff0ae58",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "result"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "66803641-1822-4894-a45b-83cae9b938a4",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.6"
+ },
+ "naas": {
+ "notebook_id": "2c8d11e1766e5b73434b99d74a5eb94415e244c13a00986210282bbc6117660c",
+ "notebook_path": "LinkedIn/LinkedIn_Setup_connection.ipynb"
+ },
+ "papermill": {
+ "default_parameters": {},
+ "environment_variables": {},
+ "parameters": {},
+ "version": "2.4.0"
+ },
+ "widgets": {
+ "application/vnd.jupyter.widget-state+json": {
+ "state": {},
+ "version_major": 2,
+ "version_minor": 0
+ }
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/LinkedIn/LinkedIn_Setup_connection.ipynb b/LinkedIn/LinkedIn_Setup_connection.ipynb
index 610948dc6c..90d9880084 100644
--- a/LinkedIn/LinkedIn_Setup_connection.ipynb
+++ b/LinkedIn/LinkedIn_Setup_connection.ipynb
@@ -271,4 +271,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}