Closed frank-f closed 6 months ago
Attention: Patch coverage is 0%
with 14 lines
in your changes are missing coverage. Please review.
Project coverage is 61.63%. Comparing base (
9b8d4c5
) to head (b62cfd8
). Report is 2 commits behind head on master.:exclamation: Current head b62cfd8 differs from pull request most recent head ff40162. Consider uploading reports for the commit ff40162 to get more accurate results
Files | Patch % | Lines |
---|---|---|
...ices/InfoProviderSystem/Providers/LCSCProvider.php | 0.00% | 14 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
See the review. Besides it looks fine, I think. Thank you
I don't understand what that Codecov report means. What do I have to do?
Its not about the Codecov reports. Its about my comment about Line 107 and 108:
This seems unnecessarily complicated. I think you could just do something like $url = trim($matches[2], '"'); to get rid of the quotes around the URL, instead of constructing a JSON object and decoding it immedeatly.
Its not about the Codecov reports. Its about my comment about Line 107 and 108:
This seems unnecessarily complicated. I think you could just do something like $url = trim($matches[2], '"'); to get rid of the quotes around the URL, instead of constructing a JSON object and decoding it immedeatly.
Oh, sorry, I don't see that comment anywhere.
I took this complicated looking approach, because the String is actually encoded and this seemed like the most fail-proof way to decode it. It looks like this in the source:
pdfUrl: "https:\u002F\u002Fwmsc.lcsc.com\u002Fwmsc\u002Fupload\u002Ffile\u002Fpdf\u002Fv2\u002Flcsc\u002F2304140030_Microchip-Tech-MCP2562T-E-MF_C191416.pdf",
LCSC changed their website. The "pdfUrl" key does not contain the link to the actual PDF anymore. It now links to a website that shows the datasheet side by side with an "add to cart" form. That does not work at all if it's downloaded by Part-DB so I patched the LCSC provider, to open the first link and extract the actual PDF URL from it. I was getting some strange errors while testing, so I included a Referrer and User-Agent header. It's been working 100% for me since then.
PS: Unfortunately I could not find an API method to get the real datasheet URL, so I resorted to scraping the HTML website. If anyone can get their hands on an LCSC API description (official or not), I'll be more than happy to update the code.