LinkedIn Saved Posts Extractor

Extracts and exports URLs, author names, and a summary from LinkedIn saved posts.

作者
Proto Pioneer
日安装量
0
总安装量
0
评分
0 0 0
版本
1.2
创建于
2025-06-20
更新于
2025-06-20
大小
22.9 KB
许可证
MIT
适用于

LinkedIn Saved Posts Extractor UserScript

Overview

This UserScript enhances your LinkedIn "Saved Posts" page by adding controls to efficiently extract and export data from your saved content. It allows you to collect post URLs, author names, and a summary of each post, offering various output formats and scrolling options.

Features

  • Comprehensive Data Extraction: Gathers Post URLs, Author Names, and a condensed Summary of each saved post.

  • Multiple Output Formats:

    • Clipboard (URLs only): Copies just the URLs to your clipboard for quick pasting.
    • CSV (Author, URL, Summary): Generates a Comma-Separated Values file with headers for easy import into spreadsheets. Summary content is properly quoted and handles internal commas and line breaks.
    • JSON Array: Creates a structured JSON file containing an array of objects, each representing a saved post with its author, url, and summary.
  • Flexible Scrolling Modes:

    • Automatic (until end or 5 min): Automatically scrolls down the page, clicking "Show more results" until all available posts are loaded or a 5-minute timeout is reached. This is ideal for extracting a large number of posts without manual intervention.
    • Manual (specify pages): Allows you to define a specific number of times the script should scroll and load more content. Useful if you only need a subset of your saved posts.
  • Data Sanitization: Automatically removes non-UTF-8 compatible control characters from extracted text (authors and summaries) to prevent encoding issues in exported files.

  • Lightweight & Non-Intrusive: Integrates directly into the LinkedIn page without heavy external dependencies.

Usage

  1. Navigate to Saved Posts: Go to https://www.linkedin.com/my-items/saved-posts/ in your browser.

  2. Locate Controls: Once the page loads, you should see a new control panel added to the sidebar on the right side of the page (typically within the section.artdeco-card element).

  3. Select Output Format:

- "Clipboard (URLs only)": Best for quick copy-pasting of just the post links.

- "CSV (Author,URL,Summary)": Choose this to generate a spreadsheet-friendly file.

- "JSON Array": For developers or advanced users who need structured data.
  1. Select Scroll Mode:
- "Automatic (until end or 5 min)": This is the default and recommended for most cases to ensure all posts are captured. The script will keep scrolling and loading until it detects the end of the list or hits a 5-minute limit.

- "Manual (specify pages)": If you select this, an input field labeled "Number of Pages" will appear. Enter the approximate number of times you want the script to scroll down and load more content. Each "page" corresponds to one scroll and "Show more" button click attempt.
  1. Start Extraction: Click the "Extract LinkedIn Posts" button.
- The button text will change to "Extracting..." to indicate progress.

- Do not close the tab or navigate away while extraction is in progress, especially in "Automatic" mode, as it needs to interact with the live page.
  1. View Output:
- For "Clipboard" output, a browser alert will confirm how many URLs were copied. You can then paste them into any text editor.

- For "CSV" or "JSON Array" output, a new browser tab will open containing the generated data. This tab will prompt you to save the file or display the raw content.

Important Notes

  • Rate Limiting: Avoid excessive or rapid extractions. LinkedIn has rate limits, and aggressive scraping could lead to temporary restrictions or flags on your account. Use the "Automatic" mode as intended, allowing it to complete its process.

  • Page Structure Changes: LinkedIn's website structure may change over time. If the script stops working as expected, it's likely due to changes in LinkedIn's HTML selectors. The POST_ITEM_SELECTOR, POST_URN_DIV_SELECTOR, AUTHOR_NAME_SELECTOR, SHOW_MORE_BUTTON_SELECTOR, and SUMMARY_SELECTOR might need updating.

  • Error Handling: The script icludes basic error logging to the browser console (accessible via F12 > Console). If you encounter issues, check the console for warnings or errors.

  • Summary Cleaning: The script attempts to remove the "…show more" text and replace line breaks within the summary to make it more suitable for CSV and JSON formats. It also sanitizes control characters.

Attribution

This UserScript was initially developed by Gemini and improved with assistance from @ProtoPioneer.

长期地址
遇到问题?请前往 GitHub 提 Issues。