feat: 增加获取图片源地址功能
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
export interface PinData {
|
||||
/** 相对路径,如 "/pins/7118240882" */
|
||||
url: string;
|
||||
/** 图片缩略图地址 */
|
||||
imgSmallSrc: string;
|
||||
/** 图片源地址 */
|
||||
imgSrc: string;
|
||||
/** 图片原始宽度 */
|
||||
@@ -120,9 +122,12 @@ export class PinCollector {
|
||||
const width = parseFloat(img.getAttribute('width') || '0');
|
||||
const height = parseFloat(img.getAttribute('height') || '0');
|
||||
|
||||
const originalSrc = img.src.replace(/_fw\d+(webp)?/, '');
|
||||
|
||||
return {
|
||||
url: href,
|
||||
imgSrc: img.src,
|
||||
imgSmallSrc: img.src,
|
||||
imgSrc: originalSrc,
|
||||
imgWidth: width,
|
||||
imgHeight: height,
|
||||
alt: altText,
|
||||
|
||||
Reference in New Issue
Block a user