Skip to content

Commit fd521ac

Browse files
authored
Update LCSCProvider field for real datasheet URL (#670)
1 parent a169623 commit fd521ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Services/InfoProviderSystem/Providers/LCSCProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ private function getRealDatasheetUrl(?string $url): string
102102
'Referer' => 'https://www.lcsc.com/product-detail/_' . $matches[2] . '.html'
103103
],
104104
]);
105-
if (preg_match('/(pdfUrl): ?("[^"]+wmsc\.lcsc\.com[^"]+\.pdf")/', $response->getContent(), $matches) > 0) {
105+
if (preg_match('/(previewPdfUrl): ?("[^"]+wmsc\.lcsc\.com[^"]+\.pdf")/', $response->getContent(), $matches) > 0) {
106106
//HACKY: The URL string contains escaped characters like \u002F, etc. To decode it, the JSON decoding is reused
107107
//See https://github.com/Part-DB/Part-DB-server/pull/582#issuecomment-2033125934
108108
$jsonObj = json_decode('{"' . $matches[1] . '": ' . $matches[2] . '}');
109-
$url = $jsonObj->pdfUrl;
109+
$url = $jsonObj->previewPdfUrl;
110110
}
111111
}
112112
return $url;

0 commit comments

Comments
 (0)