过去一个月左右,我在Vinted上卖了不少东西,想知道自己赚了多少钱,但Vinted并不提供这方面的数据,至少没有以直观的方式呈现。他们有月度报告,但那只显示你的初始资金和最终资金,而且只有在你没有提现或消费的情况下才有效,而我恰好就是这样。
于是我去了已售商品页面,滚动无限滚动列表,直到加载完一个月以来的商品,然后编写了这个代码片段,用于获取商品的价格和标题并将其添加到剪贴板。
list = document . getElementsByClassName ( 'my-orders-content' ) [ 0 ]
items = Array . from ( list . querySelectorAll ( 'a .web_ui__Cell__content' ) )
data = items . map ( i => {
price = i . getElementsByClassName ( 'web_ui__Text__text' ) [ 0 ] . innerText
title = i . getElementsByClassName ( 'web_ui__Cell__title' ) [ 0 ] . innerText
return ` ${ price } // ${ title } `
} ) . join ( '\n' )
copy ( data )
输出结果大致如下,我可以将其粘贴到Numi或Soulver中计算总价。由于页面上没有标题,因此捆绑包没有合适的标题。
