M0rtzz.com

May 26, 2024Last Updated: October 18, 2024

导出CSDN的收藏夹内容到本地

JavaScript3.1 min to read

导出 CSDN 的收藏夹内容到本地

1

直接点击网站右上角的头像

image-20240119225341349

之后点击收藏

image-20240119225504799

展开你想保存的收藏夹,比如我选择LaTeX收藏夹

image-20240119231450134

2

按键盘 F12 或者右键网页空白处选择检查

在控制台(Console)中输入以下代码后回车会让你选择文件的保存位置

image-20240119225855682

image-20240119230114625

/**
 * @brief - 将文本内容保存到文件
 * @param {string} text - 要保存的文本内容
 * @param {string} file_name - 要保存的文件名
 */
function saveTextToFile(text, file_name) {
    var blob = new Blob([text], { type: 'text/plain' });
    var a = document.createElement('a');
    a.href = URL.createObjectURL(blob);
    a.download = file_name;
    a.click();
}

var output = ''; // 用于保存最终的输出文本内容

$('.collect-second-li a').each(function (index) {
    var href = $(this).attr('href'); // 获取链接地址
    var title = $(this).text(); // 获取链接标题
    output += (index + 1) + '. ' + title + '\n' + href + '\n\n';
});

saveTextToFile(output, 'output.txt');

3

查看保存的文件:

image-20240119231531508

大功告成~


以下为测试内容:

MDX components

Code Group

export const repoName = 'm0rtzz.blog'
export const repoOwner = 'M0rtzz'
export const site = 'https://m0rtzz.com'

Details

Details

Details Block

schema:
  - https://api.github.com/graphql:
      headers:
        Authorization: Bearer ${GITHUB_TOKEN}
documents: '**/*.ts'

Details block is a collapsible component.

Github Alerts

note

Useful information that users should know, even when skimming content.

tip

Helpful advice for doing things better or more easily.

important

Key information users need to know to achieve their goal.

warning

Urgent info that needs immediate user attention to avoid problems.

caution

Advises about risks or negative outcomes of certain actions.

Shiki

Twoslash


interface Todo {
  : string
}

const : <Todo> = {
  : 'Delete inactive users'.(),
}

.title = 'Hello'
Cannot assign to 'title' because it is a read-only property.
.p('123', 10)
Custom log message
const = 1
Custom error message
const = 1
Custom warning message
const = 1
Custom annotation message

Shiki Transformers

transformerNotationDiff

console.log('hewwo') 
console.log('hello') 
console.log('goodbye')

transformerNotationHighlight

console.log('Not highlighted')
console.log('Highlighted') 
console.log('Not highlighted')

console.log('Highlighted')
console.log('Highlighted')
console.log('Not highlighted')

transformerNotationWordHighlight

const message = 'Hello World'
console.log(message) // prints Hello World
const message = 'Hello World'
console.log(message) // prints Hello World

transformerNotationFocus

console.log('Not focused')
console.log('Focused') 
console.log('Not focused')

console.log('Focused')
console.log('Focused')
console.log('Not focused')

transformerNotationErrorLevel

console.log('No errors or warnings')
console.error('Error') 
console.warn('Warning') 

transformerMetaHighlight

console.log('1')
console.log('2')
console.log('3')
console.log('4')

transformerMetaWordHighlight

const msg = 'Hello World'
console.log(msg) // prints Hello World